In a for loop which runs through all files, as in:
for file in `ls` do #stuff done
How do I have it make sure it iterates file-by-file? The following example, to play all mp3s in the current directory:
for file in `ls` do mpg123 $file done
...will do just a fine job, so long as none of the file names have any spaces in them. If my directory contained:
Aerosmith - Walk This Way.mp3 (They Might Be Giants) - Istanbul.mp3 Pink Floyd - The Wall.mp3
Then the preceding instructions first try to play "Aerosmith", then "-", then "Walk", then "This", then "Way.mp3", then "(They"... you get the idea. All of which fail, and this could lead to dangerous results if you're doing something other than mpg123 to it, like "rm", and there were also a file simply called "Aerosmith".
So how can one have the for loop separate the elements of the list only by newlines ("\n"), filling the contents of "file" with the whole line, and not separate by spaces, tabs, or other white space?
Thx,
-- Stephan
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]