Bash中扩展的通配符是否保证按字母顺序排列?我被迫将一个大文件拆分成10 Mb片段,以便我的Mercurial存储库可以接受它们.
所以我以为我可以使用:
split -b 10485760 Big.file BigFilePiece.
然后代替:
cat BigFile | bigFileProcessor
我可以:
cat BigFilePiece.* | bigFileProcessor
取而代之.
但是,我无法找到保证星号(也就是通配符,又名*)的扩展始终按字母顺序排列的地方,以便.aa在.ab之前出现(而不是时间戳排序或类似的东西).
是的,全球扩张是按字母顺序排列的.
从Bash手册页:
Pathname Expansion
After word splitting,unless the
-f
option has been set,bash scans
each word for the characters*
,?
,and[
. If one of these characters appears,then the word is regarded as a pattern,and replaced with an alphabetically sorted list of file names matching the pattern.