while [ $# -gt 0 ]; do case "$1" in -p|--p_out=*) p_out="${1#*=}" ;; -a|--arg_1=*) arg_1="${1#*=}" ;; *) printf "***************************\n" printf "* Error: Invalid argument.*\n" printf "***************************\n" exit 1 esac shift done
How to parse command-line arguments in a bash script
Issue
TagsContrib