Given a program that requires some parameters, e.g. program -in file.in -out file.out, what would be the simple-most approach to write a bash script that could be called with or without any of these parameters and use default values for each?script -in otherfile would run program -in otherfile -out file.out,script -out otherout -furtherswitch would run program -in file.in -out otherout -furtherswitch etc.
How to write a very simple wrapper that provides default parameters?
bash;shell script;parameter
A default value is easy to define in Bash:foo=${bar-default} # Sets foo to the value of $bar if defined, default otherwisefoo=${bar:-default} # Sets foo to the value of $bar if defined or empty, default otherwiseTo process your parameters, you can use a simple loop:while truedo    case ${1-} in        -in)            infile=${2-}            shift 2            ;;        -out)            outfile=${2-}            shift 2            ;;        *)            break            ;;    esacdoneprogram -in ${infile-otherfile} -out ${outfile-otherout} $@Useful reads:Parameter handlingPassing parameters to another scriptI also recommend using getopt instead, because it is able to handle many special cases which would very quickly complicate and clutter your code (Non-trivial example).