Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
两者有什么区别
[[ -n $VAR ]]
和
[[ -n ${VAR:-} ]]
?
我什么时候应该使用第二次测试?
语法${VAR:-value}替代valuewhen$VAR为空或未设置。没有特别的理由(我能想到)将此语法与空的value.
${VAR:-value}
value
$VAR