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

Popular posts from this blog

Chemistry - Bond Angles In NH3 And NCl3

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?