${parameter−default}, ${parameter:−default}
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.
阅读(616) | 评论(0) | 转发(0) |