I'm attempting to send a binary string to a program using ANSI-C quoted strings. This works fine:
echo $'\x23\x51\x66\x39\x01\x5f\x2f' | cat -v # output: #Qf9^A_/ However, if I have a NUL character (ASCII code 0) in the data, it terminates the string:
echo $'\x23\x00\x66\x39\x01\x5f\x2f' | cat -v # output: # I'm aware that strings in the C language are null-terminated so I'm guessing a similar constraint applies to this quoting method.
Is there a way I can send ASCII 0 to my program?