小编sun*_*leo的帖子

在 shell 脚本中找不到命令

请告诉我为什么我无法打印变量值。

# chmod 777 chkscript.sh
# ./chkscript.sh
Run Code Online (Sandbox Code Playgroud)

chkscript.sh文件内容

variable = "This is variable"

echo "$variable"

echo "Hello World "
Run Code Online (Sandbox Code Playgroud)

输出 :

# ./chkscript.sh
./chkscript.sh: line 5: variable: command not found

Hello World
#
Run Code Online (Sandbox Code Playgroud)

PS: 有时

 variable1 = "/home/files" --- which is location if I try to print nothing gets printed.
 echo "$variable"
Run Code Online (Sandbox Code Playgroud)

shell-script variable

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

shell-script ×1

variable ×1