I have been messing around with ticks, parenthesis, brackets etc. forever, and didn't seem to find anything useful on google... but I seem to be having a problem with the fact that some of my files have spaces in the names. Originally, this script was working for files without spaces int the name, but it appeared to view a space as a deliminator when I was trying to iterate.

Surely, though, people write bash scripts like this in function... in fact, this started from a fully functional script I have for making thumbnails for a series of image files. What is different?


for FILENAME in "`find . -name "*.mp3" -print`"

ARTIST="`exiftool  -Artist "$FILENAME" -p '$Artist'`"
TITLE="`exiftool  -Title "$FILENAME" -p '$Title'`"
ALBUM="`exiftool  -Album "$FILENAME" -p '$Album'`"
YEAR="`exiftool  -Year "$FILENAME"  -p '$Year'`"
DIRECTORY="`exiftool  -Directory "$FILENAME"  -p '$Directory'`"

ruby /home/pimeson/.kde/share/apps/amarok/scripts/wiki_lyrics/cli/wikilyrics.rb -a $ARTIST -t $TITLE -l $ALBUM -y $YEAR --sites cs,P3,yan,o,rics,iki,Download,Mania,ular,rics,5,etras > "$DIRECTORY/$TITLE.txt"

Right now I test it and get an error like
Unsuccessful stat on filename containing newline at /usr/bin/exiftool line 625.
Unsuccessful stat on filename containing newline at /usr/bin/exiftool line 742.
File not found: ./Styx/Styx - Mr. Roboto.mp3
When I tell it to "echo $FILENAME" I get, for example.
./Styx/Styx - Mr. Roboto.mp3 ./Styx/StyxMrRoboto.mp3
Any ideas?