Bash variable expansion syntax with braces
Question
What does the following bash syntax mean?
MY_VAR=${MY_VAR:-"mystring"}
Thank you in advance.
Solution
See Parameter Expansion in man bash
:
${parameter:-word}
Use Default Values. If
parameter
is unset or null, the expansion ofword
is substituted. Otherwise, the value ofparameter
is substituted.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow