因为extglob不起作用.你必须在模式列表的开头放置一个修饰符(在本例中为(txt | doc)),如下所示(来自man bash):
?(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
具体来说,ls *.*(txt | doc)产生我猜你想要的行为.