Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用bash变量作为可执行文件和文件的路径_Bash_Shell - Fatal编程技术网

使用bash变量作为可执行文件和文件的路径

使用bash变量作为可执行文件和文件的路径,bash,shell,Bash,Shell,我正在尝试使用变量编写一个简单的bash脚本,以便将来可以轻松地替换文件位置。但我肯定错过了什么。我在这里有一个bash命令: /Applications/Wakanda\ 1.1.4\ Enterprise/wakanda-enterprise-server.app/Contents/MacOS/wakanda-enterprise-server /Users/steveduisterhof/Desktop/GwS_Jeannie1.1.3/Jeannie\ Solution/Jeannie.

我正在尝试使用变量编写一个简单的bash脚本,以便将来可以轻松地替换文件位置。但我肯定错过了什么。我在这里有一个bash命令:

/Applications/Wakanda\ 1.1.4\ Enterprise/wakanda-enterprise-server.app/Contents/MacOS/wakanda-enterprise-server /Users/steveduisterhof/Desktop/GwS_Jeannie1.1.3/Jeannie\ Solution/Jeannie.waSolution
这是可行的,但当我尝试执行这个bash脚本时:

WAKSERV=/Applications/Wakanda\ 1.1.4\ Enterprise/wakanda-enterprise-server.app/Contents/MacOS/wakanda-enterprise-server

JEANNIESOL=/Users/steveduisterhof/Desktop/GwS_Jeannie1.1.3/Jeannie\ Solution/Jeannie.waSolution

“$WAKSERV” “$JEANNIESOL”
它给出了错误

Mac-Pro:~ steveduisterhof$
/Users/steveduisterhof/Desktop/startJeannie ; exit;
/Users/steveduisterhof/Desktop/startJeannie: line 8: “??: command not found
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

我对这个很陌生,所以这可能是显而易见的,但我不知道它是什么。

不是
。只有ASCII引号是shell的语法。您使用了错误的引号类型。它们必须是纯ASCII引号(
),而不是Unicode U+201C(
)和U+201D(
)。如果我们要以重复而不是打字错误来结束此操作,则是一个候选项。同样,(两者都有不同的描述,但有相同的根本原因和相同的修复)。在编辑程序时始终关闭“智能引号”。好了,没有使用卷引号的编程语言,它们都使用
和/或
。谢谢,我只是在mac上使用textedit来制作脚本。如果我在其他地方没有遇到这个问题,也许我应该使用另一个程序来编辑脚本。
不是
。只有ASCII引号才是shell的语法。您使用的引号类型错误。它们必须是纯ASCII引号(
),而不是Unicode U+201C(
”)和U+201D(
)。如果我们要以重复而不是键入来关闭此项,则是一个候选项。同样地,(两者具有不同的描述,但相同的根本原因和相同的修复)。始终关闭“智能引号”当你编辑程序时。好吧,没有使用卷曲引号的编程语言,它们都使用
和/或
。谢谢,我只是在mac上使用textedit制作脚本。如果在其他地方没有这个问题,也许我应该使用另一个程序来编辑脚本。