${(i)…}
: Sort case-insensitively
(i)
enables case-insensitive sorting.
Combined with O
the sort order is reversed: ${(iO)name}
.
Combined with n
decimal integers are sorted numerically: ${(in)name}
.
Links
Examples
- Sorting an array
- Output:
1 2 3
declare data=(z X A a 0 1 10 11 100 111) echo "Default settings: " ${(o)data} echo "Support for negative and integers: " ${(o-)data}
1 2
Default settings: 0 1 10 100 11 111 a A X z Support for negative and integers: 0 1 10 11 100 111 a A X z
BashSupport Pro is a Zsh IDE with support for ${(i)…} – try it now!