标签:demo 返回 value tput dem 定义 block 字符串 echo
${a-defaultvalue}
a如果没有定义,则表达式返回默认值,否则返回a的值;
a=""
ret1=${a-"/usr/local"}
echo "ret1:" $ret1
output:
ret1:
ret1=${a-"/usr/local"}
echo "ret1:" $ret1
output:
ret1:/usr/local
${a:-defaultvalue}
a没有定义或者为空字符串,则表达式返回默认值,否则返回a的值;
a=""
ret1=${a:-"/usr/local"}
echo "ret1:" $ret1
output:
ret1:/usr/local
ret1=${a:-"/usr/local"}
echo "ret1:" $ret1
output:
ret1:/usr/local
标签:demo 返回 value tput dem 定义 block 字符串 echo
原文地址:https://www.cnblogs.com/lanyangsh/p/10055900.html