${(o)…}
: Sort in ascending order
(o)
sorts in ascending order. It’s the default sort order of flags a
, i
, n
, and -
.
O
is the opposite and sets descending sort order.
Links
Examples
- Lexical, case-sensitive sorting in ascending order
- Output:
1 2
declare data=(z X A a) echo "Sorted with default settings: " ${(o)data}
1
Sorted with default settings: a A X z
BashSupport Pro is a Zsh IDE with support for ${(o)…} – try it now!