Often times you will want to write a BASH script where you don’t want to have to keep track of all of the positional command line arguments and/or you might want to configure it with a set of environmental variables while having a default value for each in the script.
Following is the syntax for declaring them in the shell script, and then an example on how to invoke it.
#!/bin/bash
: ${ARG1:="somedefault_arg1"}
: ${ARG2:="10"}
echo "ARG1 = $ARG1"
echo
→ Continue reading “BASH Script With Default Arguments Defined in The Script”