插入符号在 zsh 中有什么作用?

pas*_*sbi 8 zsh wildcards

插入符号^在 zsh 中有什么作用? echo ^列出当前目录中的文件,如ls. 我使用grml

显然它不是别名并且which ^打印与which $(ls). 同时command -v ^打印任何操作并返回1。

我可以假设^行为像包含当前目录中的文件的变量吗?

thr*_*rig 10

$ PS1='%% ' zsh -f
% print ^
^
% setopt EXTENDED_GLOB
% print ^
...
% 
Run Code Online (Sandbox Code Playgroud)

所以,你必须EXTENDED_GLOB启用,因此^是一个 glob,所以在挖掘之后zshexpn(1)我们发现

   ^x     (Requires EXTENDED_GLOB to be set.)  Matches anything except the
          pattern x.  This has a higher precedence than `/', so `^foo/bar'
          will  search  directories in `.' except `./foo' for a file named
          `bar'.
Run Code Online (Sandbox Code Playgroud)

因此,“除 x 之外的所有内容”都匹配所有内容,因为您没有排除任何带有空白 x 的内容。