--- tags: - bash --- ``` #!/bin/bash while getopts "ab:c" opt; do case "$opt" in a) echo "Option -a was specified." ;; b) echo "Option -b was specified with argument: $OPTARG" ;; c) echo "Option -c was specified." ;; \?) echo "Invalid option: -$OPTARG" >&2 exit 1 ;; esac done shift $((OPTIND - 1)) echo "Remaining arguments: $@" ``` man bash // getopt The **colon** after b in getopts indicates that it has an argument.