[plug] word splitting

gavan at iinet.net.au gavan at iinet.net.au
Wed Nov 17 15:01:37 WST 2004


I have a question with what I know will be an easy answer, but I can't for the 
life of me find it anywhere:
How do I disable word-splitting in a bash script?
Using the following script:

for img in `ls *.jpg`
do
    echo $img
done

it works fine as long as there are no spaces in the filename - if there's a 
space, $img is broken down into words (eg, if the filename is "file name.jpg", 
$img on the first iteration is "file" & on the second iteration is "name.jpg").

Gavan Blunt.





More information about the plug mailing list