标签: bash input console
在控制台输入时,如果我留空2美元,我希望它是10,我该怎么做? 我的代码是这个,但它不起作用
${2:-10}
我也试过
${2:=10}
答案 0 :(得分:0)
试试这个:
[[ -z "$2" ]] && set -- "$1" "10"