show_help() { echo "Usage: ..." exit 0 } [ -z $1 ] && show_help input="$1" OPTIND=1 output_file="default.txt" while getopts "h?vo:" opt; do case "$opt" in h|\?) show_help ;; o) output_file=$OPTARG ;; esac done shift $((OPTIND-1))