Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ディレクトリにこれらすべてのファイルがあるとしましょう:
$ ls file1 file2 file3 file4 ... file200
すべてのファイルを削除したいのですが、file4. zsh私はこのようにするのに慣れています:
file4
zsh
$ rm ^file4
どうすればこれを行うことができfishますか?
fish
find一般に、より強力なコマンドを使用できます。書くのは少し不便ですが。
find
find . -not -name file4 -type f | xargs rm
編集
より単純なユースケース向けの短いもの:
ls | grep -v file4 | xargs rm