coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Understanding stdbuf


From: Peng Yu
Subject: Understanding stdbuf
Date: Wed, 14 Nov 2018 23:06:24 -0600

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

[Prev in Thread] Current Thread [Next in Thread]