鉴于此目录内容:
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”结尾的任何内容。