bash arguments
#!/usr/bin/env bash
set -x
set -e
if [ $# -eq 0 ]; then
echo "Received no arguments. Exiting..."
exit
fi
# $@ is one-based and not zero-based
echo "got arguments: $@"
echo "--------"
for arg in "$@"
do
echo "arg: $arg"
done
echo "--------"
echo "\$0: $0" # $0 is the name of the shell or shell script
echo "\$1: $1" # $1 is the first argument
echo "\$2: $2" # $2 is the second argument
echo "\$3: $3" # etc
echo "\$4: $4"