2011-12-16 222 views

回答

3

如果启用在bash(shopt -s extglobextglob,您可以使用

cat !(excluded_file|excluded_*_pattern) 

extglob模式:

| 
    or/alternatives 
?(pattern-list) 
    Matches zero or one occurrence of the given patterns 
*(pattern-list) 
    Matches zero or more occurrences of the given patterns 
+(pattern-list) 
    Matches one or more occurrences of the given patterns 
@(pattern-list) 
    Matches one of the given patterns 
!(pattern-list) 
    Matches anything except one of the given patterns 
+0

我在达尔文,你的`extglob`使代码运行提供了`-bash:禁用了javascript:extglob:无效选项name` – 2011-12-16 19:32:08

+0

对不起,我`-o`最初(混吧使用`set -o`),你用修正的`-s`来试试它吗? – Kevin 2011-12-16 19:38:32

1

也许不是最好方式,但:

tcsh -c 'echo ^__*__' 
1
$ ls 
__a__ __b__ c 

$ cat * 
aaaaaaaaaaaaa 
bbbbbbbbbbbbbb 
ccccccccccccccc 

$ cat [!_] 
ccccccccccccccc 
相关问题