getopts can easily set shell variables you can use for parsing (impossible for an .... bin/bash while getopts ":a" opt; do case $opt in a) echo "-a was triggered!
wiki.bash-hackers.org