[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash script problem [OT?]



Soare Catalin <lolinux.soare@gmail.com> writes:

>Thank you everyone for replying, but unfortunately, nothing seems to work
>for the moment, although all the answers appear to make sense.
>First, the array solution appears to work, but when tar gets all the
>parameters, they become a long string without spaces :), obviously "cannot
>stat: No such file or directory".

Please post the code you have ended up with. The array method I posted
will work, but you may be using it incorrectly. From the bash man page:

     If the word is double-quoted, ${name[*]} expands to a single word
     with the value of each array member separated by the first character
     of the IFS special variable, and ${name[@]} expands each element of
     name to a separate word.

That is, the literal "${name[@]}" expands to each element of the array
"name" as a separate word. Not one long word as you have experienced.

I've used this method plenty of times in the past, so I know it does work.
What version of bash are you using? (bash --version)


Reply to: