I want to run a script which accepts 3 command line options -o|q|i
. I want to make the q
and o
but not i
so run command has to look like:
script.sh -q <some-text> -o <some-other-text>
The below code makes none of them mandatory. How can I achieve this?
for arg in "$@"
do
case $arg in
-q) req="$2"
shift shift ;;
-o) out="$2"
shift shift ;;
-i|) ind="$2"
shift shift ;;
esac
done