shell 变量设定默认值 ${parameter:-word}

Reference: [ variable assignment in scripts ]


Full List

all


Script

$echo ${JENKINS_VERSION:-2.7.4}
2.7.4
$JENKINS_VERSION=2.99
$echo ${JENKINS_VERSION:-2.7.4}
2.99

原文地址:https://www.cnblogs.com/tiantiandas/p/shell_set_default_value_for_unset_variable.html