How to make output of any shell command unbuffered?

后端 未结 4 2019
天命终不由人
天命终不由人 2020-11-22 16:25

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

4条回答
  •  猫巷女王i
    2020-11-22 17:13

    Try stdbuf, included in GNU coreutils and thus virtually any Linux distro. This sets the buffer length for input, output and error to zero:

    stdbuf -i0 -o0 -e0 command
    

提交回复
热议问题