On Sunday, August 31st, 2025 at 3:12 PM, Andreas Schwab <[email protected]> wrote: > On Aug 31 2025, Maria wrote: > > > When I redirect the output of a command that sleeps into a process > > substitution with a process that finishes immediately (like "echo" or > > a process that doesn't exist), after the first sleep, Bash will crash > > with exit code 141. > > > This is not a crash, it is normal behaviour in presence of a signal. > You can replace the shell command with any program that produces enough > output, you will get exactly the same behaviour. > > $ yes > >(:); echo $? > > 141 > $ yes | :; echo ${PIPESTATUS[*]} > 141 0 > > (141 is 128 + SIGPIPE.)
Please try the command I provided, particularly the one that starts with "for". I tried the input you provided, and indeed it is just the subprocess that exits, but with my input, it is Bash itself that exits, not the subprocess.
