Is there a way to run shell commands without output buffering?
For example, hexdump file | ./my_script
will only pass input from hexdump to my_script in
You could also use the script
command to make the output of hexdump
line-buffered (hexdump
will be run in a pseudo terminal which tricks hexdump
into thinking its writing its stdout to a terminal, and not to a pipe).
# cf. http://unix.stackexchange.com/questions/25372/turn-off-buffering-in-pipe/
stty -echo -onlcr
script -q /dev/null hexdump file | ./my_script # FreeBSD, Mac OS X
script -q -c "hexdump file" /dev/null | ./my_script # Linux
stty echo onlcr