${(c)…}: Number of characters in array

${(c)#array} counts the characters in an array as if the elements were joined with a space.

Examples

Print characters of joined array
1
2
values=(a b c)
echo ${(c)#values}
Output:
1
5
BashSupport Pro is a Zsh IDE with support for ${(c)…}try it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal