When using the ${parameter:-word}
form of parameter expansion to evaluate to a default value if the variable is unset, what is the best practice for quotes?
For example, assume a Bash shell script with -u
set (to generate an error when an undefined or unset variable is evaluated), to test if a variable has a value, what would be the best way to write the equivalent of if [[ -z "$FOO" ]]
?
if [[ -z "${FOO:-}" ]]
or
if [[ -z ${FOO:-""} ]]
or something else?