[Top][All Lists]

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

Re: some problems with scope of fds in process substitution

From: Stephane Chazelas
Subject: Re: some problems with scope of fds in process substitution
Date: Mon, 4 Dec 2017 15:19:04 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

2017-12-04 08:46:24 -0500, Chet Ramey:
> Bash-4.4 allows you to wait for the last process substitution, since the
> pid appears in $!, like ksh93.


I hadn't noticed it had changed in 4.4

One major differnce with ksh93 though is that it won't work with

cmd | tee >(cmd2)

unless you enable lastpipe.


cmd | tee >(cmd2) | cmd3

you won't get access to cmd2's pid in $! either in ksh93, but
those are usually OK as cmd2's stdout also goes to the pipe to
cmd3, so "waited for" by virtue of cmd3 waiting for it.

In any case, one can always work around it without lastpipe by doing:

cmd | (tee >(cmd2); ret=$?; wait "$!" || exit "$ret")

> There's still no option to wait for more
> than one, though I imagine I could make that work as part of `wait'
> without arguments.

Yes, that would be useful and align with ksh93.

That could however break some work flows like

exec > >(tee logfile) # not supported by ksh93

cmd1 & cmd2 &


  cmd1 & cmd2 &
} > >(tee logfile)


reply via email to

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