You might consider using getopts for your option parsing, and ask the user to select a function if the option is not present:
usage() { echo "usage: $0 ..." >&2 exit $1 } main() { local func opt while getopts 'hdu' opt; do case $opt in h) usage 0 ;; d) func=download ;; u) func=upload ;; *) usage 1 ;; esac done shift $((OPTIND - 1)) [[ $# -eq 0 ]] && usage 1 # get the user to select upload or download if [[ -z $func ]]; then PS3='Choose a function: ' select func in upload download; do [[ -n $func ]] && break done fi # now, invoke the function with the argument "$func" "$1" } main "$@"