您如何在Shell脚本中使用chmod

kak*_*234 1 shell chmod

因此,这在shell脚本中:

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

chmod a+rwx $trialName
Run Code Online (Sandbox Code Playgroud)

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

Tim*_*ote 5

您需要在后面删除空格=

trialName="trial.txt" # note the absence of the space between '=' and '"'
chmod a+rwx "$trialName"
Run Code Online (Sandbox Code Playgroud)