I followed the tutorial here to learn how to use getopts. I'm able to execute all the options properly provided by the user. But now I want to execute a default option when none of the options are provided.For e.g:while getopts :hr opt; do    case $opt in        h )            show_help;            exit 1            ;;        r )          echo Default option executed          ;;    esacdoneSo, if the user provides with either -h or -r, the corresponding commands should be executed (which actually does) but when none of these options are provided -r should be executed by default. Is there a way to achieve this?UPDATEI tried cas's suggestion and included *) to my getopts function but nothing seems to be happening.while getopts :hr opt; do    case $opt in        h )            show_help;            exit 1            ;;        r )          echo Default option executed          ;;        \? )          echo error Invalid option: -$OPTARG >&2          exit 1          ;;        : )          echo error Option -$OPTARG requires an argument.          exit 1          ;;        * )          echo Default option executed          ;;    esacdoneIs there something wrong with this snippet?
Execute default option when no options are specified in getopts
shell script;getopts