${(#)…}: Evaluate as character codes

Evaluates the resulting words as character codes and converts them into corresponding characters.

Examples

Print message using ASCII values
1
2
3
4
5
6
7
# decimal ASCII values
ascii=(72 101 108 108 111)
echo ${(#)ascii}
  
# hex ASCII values
ascii=(0x57 0x6F 0x72 0x6C 0x64)
echo ${(#)ascii}
Output:
1
2
H e l l o
W o r l d
BashSupport Pro is a Zsh IDE with support for ${(#)…}try it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal