I'm trying to make a script with the following usage:
bash script.sh [-a] databases ...
The script then populates the array $databases with the arguments from 'databases'
databases=("$@")
Now I'm trying to implement the option -a which if set should declare att=1:
while getopts "a" o; do
case "${o}" in
a)
att=1
;;
esac
done
Now I'm facing the problem that when executing the script -a also gets put into the array.
I can't use read for the array because I don't have the option to enter additional arguments after the script gets executed as the script will be automated with a RMM and that only lets you enter addition arguments when creating a job.