On Friday 09 December 2016, Paul Groves wrote:
On 08/12/16 20:27, Greg Freemyer wrote:
I have my array (my ISOs in this case): files[0]="/srv/media/PS2 Games/" files[1]="/srv/media/PS1 Games/"
then I have my loop: file_list="" #use variable $file_list for file in ${files[@]}; do file_list="$file_list \"$file\"" done
Your method will not work reliable. Use "${files[@]}" (including the quotes) instead of your file_list as parameter to tar. Have another look at the sample I gave yesterday and see that the "touch" creates the files exactly like they were specified as the individual list elements. You will not get your method working reliable, especially if something like quotes (") are part of the filename, as you throw away the semantics the list gives you (clearly separate members and not something which needs interpretation in one big concatenated string where boundaries again need to be found reliable). BTW: With files[1]="1" files[2]="2a'2b" files[3]=" 3 \" 4 " files[4]="5" files[5]="6 7" files[6]='"8 9"' as files your method produces the files: with 'touch $file_list': """ ""8" "1" "2a'2b" "3" "4" "5" "6" "7" "9"" or with 'touch "$file_list"' the single file "1" "2a'2b" "3" """ "4" "5" "6" "7" ""8" "9"" as output of the touch command (including ALL the quotes). touch simply creates the individual members it received on the command line. Andreas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org