简体   繁体   中英

Sorting glob qualifiers do nothing in zsh

I want to use the glob qualifiers in zsh to sort files by various criteria. For example, ls -l *(.oL) is supposed to return ordinary files sorted by size.

Everything else in zsh seems to work as advertised, but the sorting operators o and O have no effect. The results are always sorted by filename.

I've tried removing my .zshrc file, but that did not fix this.

I'm on Debian 11 and installed zsh from the repository, getting me v. 5.8.

Charles Duffy is correct, it is ls that is re-sorting the files alphabetically. We can see this using his suggestions or simply by using echo .

ls has its own sorting flags, but I wanted to commit just one syntax to memory. Filename sorting in ls can be disabled with the -U flag.

It's odd, because several popular guides to zsh that I consulted all use sorting examples with ls . Has ls changed its behavior recently? Is the version distributed with Debian unusual?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM