I already have a code snippet for parsing individual command-line arguments (in this case -a
, -o
, -O
and their long forms). However, I want to parse combinations of these arguments, e.g. -ao
or -aO
.
It might be worth noting that I don't want -o
and -O
together, as they are opposites and only one of them is meant to be used at once.
Here's my current code snippet. All used variables here (AURF
, DAO
) are initialized with a value of 0.
while [[ $# -gt 0 ]]; do
case $1 in
-a|--aur) AURF=1;;
-o|--orphan) DAO=1;;
-O|--no-orphan) DAO=-1;;
esac
shift
done