${parameter−default}, ${parameter:−default}
If parameter not set, use default.
echo ${username−`whoami`}
# Echoes the result of `whoami`, if variable $username is still unset.
If parameter not set, use default.
echo ${username−`whoami`}
# Echoes the result of `whoami`, if variable $username is still unset.
${parameter−default} and ${parameter:−default} are almost
equivalent. The extra : makes a difference only when parameter has been declared,
but is null.
equivalent. The extra : makes a difference only when parameter has been declared,
but is null.