2

所以这是在一个shell脚本中:

#!/bin/bash
trialName= "trial.txt"

chmod a+rwx $trialName

这真的行不通。我正在尝试添加单引号/双引号,$trialName但这也不起作用。我有什么办法可以做到吗?

4

2 回答 2

7

您需要删除之后的空格=

trialName="trial.txt" # note the absence of the space between '=' and '"'
chmod a+rwx "$trialName"
于 2012-07-09T21:08:16.470 回答
3
#!/bin/bash
TRIALNAME="trial.txt"

chmod a+rwx $TRIALNAME

它有效吗?之间不能有空格=

于 2012-07-09T21:09:45.847 回答