为什么这两个相似的命令变体给出不同的输出?

Ved*_*rla 2 bash

命令 1:

$ rm hello.txt 2>/dev/null || { echo “Couldn’t delete hello.txt” }
"Couldn't delete hello.txt"
Run Code Online (Sandbox Code Playgroud)

命令 2

$ rm hello.txt 2>/dev/null || { echo 'Couldn’t delete hello.txt' }
Couldn't delete hello.txt
Run Code Online (Sandbox Code Playgroud)

注意: hello.txt当前目录中不存在。

Ale*_*exP 15

第一条命令

rm hello.txt 2>/dev/null || { echo “Couldn’t delete hello.txt” }
Run Code Online (Sandbox Code Playgroud)

包含字符<U+201C>(LEFT DOUBLE QUOTATION MARK)、<U+2019>(RIGHT SINGLE QUOTATION MARK) 和<U+201D>(RIGHT DOUBLE QUOTATION MARK),这些字符对 shell 来说没有任何特殊性,并且是这样输出的。

第二条命令

rm hello.txt 2>/dev/null || { echo 'Couldn’t delete hello.txt' }
Run Code Online (Sandbox Code Playgroud)

包含用单引号括起来的字符串;和 之间的字符nt<U+2019>,这对外壳来说并不特殊。