Results 1 to 2 of 2

Thread: variable quastion

  1. #1
    Join Date
    Dec 2009
    Location
    Slovenia
    Beans
    108
    Distro
    Ubuntu 10.10 Maverick Meerkat

    variable quastion

    Hello!

    I have a variable TEST and i want its value to take all file names with extensin .c, and separate them with whitespace.

    Example:
    If i have files one.c, two.c, three.c etc, value would be asigned like this:
    Code:
    TEST=one.c two.c three.c ...
    I want this to work even if blue parts of the name are random. Anyone knows anwser to this? I d appreciate it.

    Regards Ziga
    student 4. grade, Fi/Te, PeF-Ljubljana

  2. #2
    Join Date
    Nov 2010
    Location
    Berlin, Germany
    Beans
    4,534
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: variable quastion

    You can use this command, it's set up for the current directory, but you can use any other "ls" option, as long as the files are not hidden. That would be a bit trickier then, but not impossible.
    Code:
    TEST=`ls *.c`
    Greetings.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •