Clogged pipe?
- Reply: Christian Weisgerber : "Re: Clogged pipe?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Apr 2023 21:52:47 UTC
On FreeBSD 13.1-RELEASE-p7 I have a small test file, named testfile, which contains three short lines of text, "one," "two," and "three" without the quotes. This command waits indefinitely without producing any output: tail -f testfile | cat -n | sed -u 's/^/X/' But, these five commands all work as expected, immediately outputting versions of the three lines of text: tail -f testfile | cat -n cat -n testfile | sed -u 's/^/X/' tail -f testfile | sed -u 's/^/X/' tail testfile | cat -n | sed -u 's/^/X/' tail -f testfile | cat | sed -u 's/^/X/' What is it about the first command, that causes it to produce no output, that isn't also the case with any of the last five? It doesn't matter whether the commands are run in sh, csh, or bash, the result is the same. Interestingly (or maybe not), the issue doesn't occur on my Debian box; all six commands produce immediate output there in both dash and bash. Can anyone explain what makes the first command behave differently than the others?