Bash, for loops and filenames with spaces
17/08/2006
For loops delimit the items on whitespace, so a filename like:
filename with spaces.txt
Will create three separate items, which in this case is not ideal:
- filename
- with
- spaces.txt
Solution
use a while loop e.g. for a file 'list.txt' with a list of filenames:
while read filename; do;done < list.txt