Bash脚本在我不';我也不想要

Bash脚本在我不';我也不想要,bash,echo,quotes,Bash,Echo,Quotes,我不知道这里发生了什么。我制作的bash脚本超过了我的份额。搜索过去的问题只是让人们问如何让这些引语持久化 当回显到/dev/tty时,引号也会回显 例如: #!/bin/sh OLDIFS=$IFS IFS=$'\n' currentfile=This.File; echo 'About to output' > /dev/tty; echo “The Currect File is $currentfile” > /dev/tty; IFS=$OLDIFS 这会引起共鸣: \#

我不知道这里发生了什么。我制作的bash脚本超过了我的份额。搜索过去的问题只是让人们问如何让这些引语持久化

当回显到/dev/tty时,引号也会回显

例如:

#!/bin/sh
OLDIFS=$IFS
IFS=$'\n'
currentfile=This.File;
echo 'About to output' > /dev/tty;
echo “The Currect File is $currentfile” > /dev/tty;
IFS=$OLDIFS
这会引起共鸣:

\#'About to output'
\#"The Currect File is ??
如果我在$currectfile后面加一个空格,我会得到一个更正确但不是我想要的:

\#'About to output'
\#"The Currect File is This.File "
我期望的结果很简单:

\#About to output
\#The Currect File is This.File

在interactive中输入这一行时,它会像预期的那样发出回声。

让我们运行代码以自动检查常见问题:

echo “The Currect File is $currentfile” > /dev/tty;
     ^-- SC1015: This is a unicode double quote. Delete and retype it.
让我们这样做:

echo "The Currect File is $currentfile" > /dev/tty;

当我正在做一个示例时,我执行了示例程序,得到了Macbook-Pro-15:Desktop user$bash anotherDirectory/test.sh即将输出的输出“当前文件是??Macbook-Pro-15:Desktop user$sh anotherDirectory/test.sh即将输出“当前文件是??因此,虽然单引号不在这里,但显示在我的主程序中,双引号是相同的。看起来代码中有U+201C(左双引号)和U+201D(右双引号),而不是U+0022(引号)。正确!我只需要全部更改。谢谢。您所说的更改是什么意思?您是否正在寻找用常规的