I recently spent some time trying to write some numbers as bytes to pipe using bash (e.g. 10 as 0xA, not 0x310x30). Unfortunately I was not able to do so and had to rewrite the script into Python. Is it any way to send data as bytes in bash script and not as characters?
I recently spent some time trying to write some numbers as bytes to pipe
Share
As chepner told, you can output any value as e.g.: $’\012′. So, a short script:
The right print will convert the decimal argument into octal number and the second print will print the octal number as above… e.g. decimal 65 will be converted into byte ‘A’.