Bash Default Value For Variable Code Example
Example 1: assign default value in shell script
FOO=${VARIABLE:-default} # If variable not set or null, use default.
Example 2: Setting default variable value in bash
FOO="${VARIABLE:=default}" # If variable not set or null, set it to default.
Comments
Post a Comment