如何配置 ZSH 命令替换以不使用反引号 (`)?

如何配置 ZSH 命令替换以不使用反引号 (`)?

我只想echo $(date)返回日期而不是反引号版本。

echo $(date) # should return Wed Mar 6 09:50:41 EST 2019
echo `date` # should return `date` 

答案1

将反引号括在强引号中以剥夺它们的底层权力:

$ echo '`echo`'
`echo`

但请注意,缩写用强引号括起来:

$ echo 'I can't process this.'
> Oh whoops that ">" means we're still in a strong quote.
I cant process this.
Oh whoops that ">" means were still in a strong quote.

相关内容