【发布时间】:2016-02-29 08:44:03
【问题描述】:
我在当前目录中有以下文件:
./
-- 1
-- a2
-- abca
-- abcb
-- abcc
-- abcd
-- abce
-- abcf
-- abcg
-- abch
-- test01
-- test02
-- test03
-- test04
-- test05
-- test06
-- test07
-- test08
-- test09
-- test10
我想删除所有test* 文件,但排除test07 和test09。
如何做到这一点?
rm test* !test07 !test09 不起作用
【问题讨论】:
-
shopt -s extglob; rm test0+(1|2|3|4|5|6|8) test10可能吗? -
find . -maxdepth 1 -name test\* ! -name test07 ! -name test09 -exec rm {} +也许?