Using --getopts to pick up whole word flags

kid_x picture kid_x · Feb 25, 2014 · Viewed 8.6k times · Source

Can getopts be used to pick up whole-word flags?

Something as follows:

while getopts ":abc --word" opt; do
    case ${opt} in
        a) SOMETHING
            ;;
        ...
        --word) echo "Do something else."
            ;;
    esac
done

Trying to pick up those double-dash flags.