How do I write non-ASCII characters using echo? Is there an escape sequence, such as \012
or something like that?
I want to append ASCII characters to a file using:
echo ?? >> file
This is easily done on a Windows platform: type the decimal ascii code (on the numeric keypad only) while holding down the ALT key, and the corresponding character is entered. For example, Alt-132 gives you a lowercase "a" with an umlaut.
If you care about portability, you'll drop echo and use printf(1):
printf '\012'
Use
echo -e "\012"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With