I thought that the -oL option will wait until a line is finished in
the line buffer. So I'd expect the following output of stdbuf -oL -eL
./script.sh.

abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz

But the actual results are interleaved. Could anybody help me
understand how stdbuf works? Thanks.

$ cat script.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

for x in {a..z}
do
    echo -n "$x"
    echo -n "$x" >&2
done
echo
echo >&2
$ stdbuf -oL -eL ./script.sh
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz

$

-- 
Regards,
Peng

Reply via email to