相关疑难解决方法(0)

何时在shell变量周围包装引号?

有人能告诉我是否应该在shell脚本中包含变量的引号?

例如,以下是正确的:

xdg-open $URL 
[ $? -eq 2 ]
Run Code Online (Sandbox Code Playgroud)

要么

xdg-open "$URL"
[ "$?" -eq "2" ]
Run Code Online (Sandbox Code Playgroud)

如果是这样,为什么?

unix linux bash shell quotes

145
推荐指数
4
解决办法
5万
查看次数

标签 统计

bash ×1

linux ×1

quotes ×1

shell ×1

unix ×1