Iterating Over Arguments in Bash
| bashArguments can be accessed using $@. In contrast to $*, $@ correctly parses quoted arguments. Given the following script name args.sh:
for var in "$@"
do
echo "$var"
doneRunning this script with the following arguments yields:
sh args.sh a b "c d"
a
b
c dPretty useful for scraping stuff, creating conditional directories, renaming files, etc…