I am trying a program (prog1) which generates binary output (it is a encoder) that I want to pass to another program (prog2) . prog2 can take data from stdin, so I would like to pipe the output of prog1 to prog2. The problem is, since it is binary data, the terminal can get corrupted.
for example
$> prog1 | prog2 –
Is there any other way ? I would like to avoid writing glue code just to route the data between the two if I can.
Thanks!
When you write
everything that prog1 write to its stdout goes to prog2, not to your tty. It is certainly possible for prog1 to write data to the terminal, either by writing binary data to stderr, or by other means, but it is more likely that your prog2 is writing binary data as well. As a simple test, try:
(If you don’t have xxd, try any hex dump program, or perhaps just
od)If that doesn’t work, try:
or
or some other variation on that theme.