奇怪的 zsh 过滤行为
strange zsh filtering behavior
正在做:
print -l ./somedir/**/*.{png,jpg}
给出了 png
和 jpg
文件的预期列表,并且它们都存在,但是
print -l ./somedir/**/*.{png,jpg}(Lk+50)
没有列出我的 jpg
大于 50k 的文件,说 no matches found ./somedir/**/*.png(Lk+50)
。
为什么它在 png
处停止,而不在 jpg
处展开?
根据文档,说:
Note that brace expansion is not part of filename generation (globbing); an expression such as */{foo,bar} is split into two separate words */foo and */bar before filename generation takes place. In particular, note that this is liable to produce a ‘no match’ error if either of the two expressions does not match; this is to be contrasted with */(foo|bar), which is treated as a single pattern but otherwise has similar effects.
我得出的结论是我必须写:
print -l ./somedir/**/*.(png|jpg)(Lk+50)
,得到想要的结果。
正在做:
print -l ./somedir/**/*.{png,jpg}
给出了 png
和 jpg
文件的预期列表,并且它们都存在,但是
print -l ./somedir/**/*.{png,jpg}(Lk+50)
没有列出我的 jpg
大于 50k 的文件,说 no matches found ./somedir/**/*.png(Lk+50)
。
为什么它在 png
处停止,而不在 jpg
处展开?
根据文档,说:
Note that brace expansion is not part of filename generation (globbing); an expression such as */{foo,bar} is split into two separate words */foo and */bar before filename generation takes place. In particular, note that this is liable to produce a ‘no match’ error if either of the two expressions does not match; this is to be contrasted with */(foo|bar), which is treated as a single pattern but otherwise has similar effects.
我得出的结论是我必须写:
print -l ./somedir/**/*.(png|jpg)(Lk+50)
,得到想要的结果。