default value expansion

The ${name:-fallback} form, which gives the fallback when the variable is unset or empty, without changing the variable.

In more detail

It is the usual way to give a script a sensible default, as in ${1:-report.txt}. The := form also assigns the fallback to the variable, and :? stops the script with an error message instead.

Example

out="${1:-report.txt}"

Related terms

Taught in

References