鉴于此目录内容:
one.file
two.file
three.file
Run Code Online (Sandbox Code Playgroud)
在 bash 中,当我输入时
rm *.file !(two)
Run Code Online (Sandbox Code Playgroud)
只有one.file
和three.file
被删除。我怎样才能在 ZSH 中做到这一点?
小智 9
我也对这个答案很感兴趣,快速搜索了这篇关于在 zsh 中通配符的文章。亮点:
^
作为否定。比如ls ^two.file
只会列出one.file和three.file。^
和*
。例如,ls ^two*
将列出不以“two”开头的任何内容ls (^two).file
将列出不以“two”开头但以“file”结尾的任何内容。