positional_args=()
while [ $# -gt 0 ]; do # While there are still arguments
if getopts "nh" option; then
case $option in
n)
something_with_an_n=yes
;;
h)
show_usage && exit 0
;;
\?)
show_usage && exit 1
;;
esac
shift $((OPTIND-1)) # Shift opts processed by getopts
else
positional_args+=($1)
shift # Shift this one positional argument
fi
done
the_first_positional=${positional_args[0]}
Created
October 23, 2019 13:47
-
-
Save nandilugio/7b7082cb59cabefbb1cfd8ccf282207f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment