我偶然发现了这件事,从那以后它一直在唠叨我:
% setopt
alwaystoend
autocd
autonamedirs
...
sharehistory
shinstdin
zle
%
% setopt | grep zle
# nothing printed
%
% setopt | cat -vet
alwaystoend$
autocd$
autonamedirs$
...
sharehistory$
shinstdin$
# no zle here!
正如您所看到的,grep
无法检测到zle
,并将setopt
的输出汇总到cat
,以便检测到任何不规则字符(而不是更有意义)也不显示zle
!
答案 0 :(得分:5)
man zshzle
...
If the ZLE option is set (which it is by default in interactive shells) and the shell input
is attached to the terminal, the user is able to edit command lines.
由于您将setopt的输出传递给进程,因此shell将关闭命令行编辑。 (虽然本文档的这一行仅涉及附加到终端的shell输入,但它捕获了问题的本质。没有什么好笑的,只是shell正在关闭选项。