加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – zsh中等号有什么特殊含义?

发布时间:2020-12-14 02:21:02 所属栏目:Linux 来源:网络整理
导读:在我的zsh脚本中,我有一条线 echo some text ================================ 令我惊讶的是,为此行发出了错误消息: zsh: =============================== not found 从命令行进行试验,我发现当有一个等号时,shell会感到沮丧: $echo =zzsh: z not found
在我的zsh脚本中,我有一条线
echo some text ================================

令我惊讶的是,为此行发出了错误消息:

zsh: =============================== not found

从命令行进行试验,我发现当有一个等号时,shell会感到沮丧:

$echo =z
zsh: z not found

但在这里,我们有:

$echo =echo
/usr/bin/echo

从这个观察来看,它看起来好像

=XXX

会被解释为

$(which XXX)

但是,我没有在zsh联机帮助页中找到任何有关此“替换”的内容.这块魔法描述在哪里?

解决方法

从 docs:

14.7.3 ‘=’ expansion

If a word begins with an unquoted ‘=’ and the EQUALS option is set,
the remainder of the word is taken as the name of a command. If a
command exists by that name,the word is replaced by the full pathname
of the command.

和here在更多的话

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读