James Tuttle wrote:
I'm need to grab a few hundred songs out of a few thousand to dump to my
wife's IPod.  I have a list of the files she selected and I wrote a
little bash script to grab them and sync them to her IPod, but it fails
on spaces in filenames.  Probably on things like ' and & and - also.
Any ideas?


#/bin/env bash

FILES="Barry White - Let's Get It On.mp3
Barry White - Shaft Theme.mp3"

for file in $FILES
  do
    if [ -e $file ]; then
      FILE_LIST="$file $FILE_LIST"
    else
      echo "$file doesn't exist"
    fi
  done

snip

Thanks,
Jim
Might do the trick:

FILE_LIST="'$file' $FILE_LIST

Could also try \" instead of ' but single quotes deal with strange characters more tactfully.

--
Michael Tharp

http://www.ircd-charybdis.org/
http://www.atheme.org/

--
TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ  : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/

Reply via email to