${(O)…}: Sort in descending order
(O) sorts in descending, lexical order.
Combined with a, i, n, or - it reverses the sort order of the result.
o is the opposite and sets ascending sort order.
Links
Examples
- Lexical, case-sensitive sorting in ascending order
- Output:
1 2declare data=(z X A a) echo "Sorted in descending order: " ${(O)data}1Sorted in descending order: z X A a
BashSupport Pro ist eine Zsh IDE mit Unterstützung für ${(O)…} - probieren Sie es jetzt aus!