I have some shell scripts on my system that fail as soon as they encounter a file or directory name containing the & character. What is the correct way to deal with this? Should I wrap double quotes around all file names in my script?
For example, script for resizing images:
Code:
#!/bin/sh
for FILE in $*
do
convert $FILE -resize 300x $FILE
done
This version works but it is the correct way to do it?
Code:
#!/bin/sh
for FILE in $*
do
convert "$FILE" -resize 300x "$FILE"
done
Paddy