I am writing a Bash Script that accepts command line arguments, but not only one at a time, but all of them at a time, using case statements.
Here is my code so far
while [ $# -gt 0 ]
do
case "$1" in
-n|--name)
name="$2"
;;
-s|--size)
size="$2"
;;
-l|--location)
location="$2"
;;
esac
done
This code only accepts one at a time, I need it to be able to specify as many as they want.
shift. Also look atgetopts, which is the right way to do this