加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Bash中,通配符扩展是否保证有序?

发布时间:2020-12-15 18:44:32 所属栏目:安全 来源:网络整理
导读:Bash中扩展的通配符是否保证按字母顺序排列?我被迫将一个大文件拆分成10 Mb片段,以便我的Mercurial存储库可以接受它们. 所以我以为我可以使用: split -b 10485760 Big.file BigFilePiece. 然后代替: cat BigFile | bigFileProcessor 我可以: cat BigFile
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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读