How do I generate ASCII codes 2 and 3 in a Bash command line?
Question
If I press Ctrl+B that ought to give me ASCII code 2, but Ctrl+C is going to be interpreted as a Break.
So I figure I've got to redirect a file in. How do I get these characters into a file?
Solution
Ctrl-V escapes the next keystoke. That's how you can get a Ctrl-C out: Ctrl-V Ctrl-C
OTHER TIPS
echo $'\002\003' > ./myfile
perl -e 'print "\xFF"'
where FF
is the hex code of the ACSII code you want to print. So for ACSII code 2, it would be \x02.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow