|
Bash expects space-delimited parameters
- Causes problems when parameters have spaces
- Example: script.sh “arg 1” “arg 2”
- $* contains “arg” “1” “arg” “2”
Solution: for VAR; do ...; done
- Automatically assigns VAR with $1, $2, etc...
- Handles spaces in parameters gracefully
- VAR would be set to “arg 1”, then “arg 2”
-
|