On Mai 12 2024, Greg Wooledge wrote:

> On Sun, May 12, 2024 at 03:55:21AM +0200, Quốc Trị Đỗ wrote:
>> I found a bug when i tried with syntax <(cmd). this is an example
>> cat <(wc -l) < bk
>
> What is "wc -l" supposed to read from?  It counts lines of standard input,
> until EOF is reached.  But its standard input is a terminal.  And you're
> running it as a background process.
>
> I would *expect* this command to fail with an error message of some
> kind, because a background process shouldn't be allowed to read
> input from a terminal.

Since the redirection fails and the cat command is never started, bash
doesn't switch the terminal process group, and the background wc command
goes on competing with bash for the terminal.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply via email to