This are some methods that have not been mentioned before:
echo -e '\u40'
echo 40 | xxd -p -r
perl -le 'print chr 64'
python <<<'print chr(64)'
python3 -c 'print(chr(64))'
php -r 'echo chr(64);'
40 value is the hexadecimal value of an ASCII character
64 in decimal (used later). That is expressed in
\x40, or read as hexadecimal (
40. The command printf converts it to a byte of such value and the console prints a
And it is also the Unicode code point value of the same character
@. It so happens that Unicode code points and ASCII character values are exactly the same (by design) up to 127 (hex
7F or octal
There is, however, a difference between
\u40. The latter will always produce an UNICODE code point, no matter what locale, language or condition is set for the OS or computer that runs the code. While
printf '\100' would output a space. And, also by design, code points in UNICODE have been assigned as static values. It is expected that they won't change in the future. In short, a
\u40 should produce a
@ even on an EBCDIC-based system (for example). For ASCII values that might seem as an small gain, but for higher code point characters, it is a real advantage as
\u2225 should always produce
∥) no matter the locale or language being used.
\uxxxx was first added in GNU printf (the standalone utility) in 2000. Then to zsh's print/printf/echo/$'...' in 2003 and a few other shells later. The $'\uxxxx' syntax is even planned for inclusion in POSIX. You need the 4 digits in the standalone printf:
printf '\u0040'. In bash, ksh93 and zsh from 1 to 4 digits are allowed. A
\Uxxxxxxxx is required to use up to 8 hex digits.
 Initial Idea from a (now erased) comment of Stéphane Chazelas