相关疑难解决方法(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:让语句与赋值

分配变量var=foo和使用let 之间的区别是什么let var=foo?或者像var=${var}barlet var+=bar?每种方法的优点和缺点是什么?

unix linux bash

54
推荐指数
1
解决办法
6万
查看次数

标签 统计

bash ×2

linux ×2

unix ×2

quotes ×1

shell ×1