[ale] bash question

Michael D. Hirsch mhirsch at nubridges.com
Tue Jul 22 09:06:41 EDT 2003


On Tuesday 22 July 2003 01:30 am, Kevin Krumwiede wrote:
> I want to do something to all the files whose names are listed in a text
> file, like this:
>
> for fname in $(cat filelist); do ...; done
>
> The problem is, some of the file names have spaces.  For example, 'My
> Song.mp3'.  The action is performed on 'My', and then on 'Song.mp3'. 
> How do I make it so each line of the file list is treated as a single
> word?

Use the read command:

while read fname; do cp "$fname" /tmp; done < filelist

Michael

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list