help-bash
[Top][All Lists]
Advanced

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

Re: Check the error status of process substitution


From: Greg Wooledge
Subject: Re: Check the error status of process substitution
Date: Mon, 6 Jun 2022 14:04:42 -0400

On Tue, Jun 07, 2022 at 02:35:27AM +0900, Masahiro Yamada wrote:
> "wait $!" does not seem to work in old bash versions.
> 
> So, I guess something was fixed between
> v4.3.48 and v4.4.20 but it looks like
> some people are still using old bash versions.

Yes, the feature you're looking for was added in bash 4.4.

If you need the exit status of a background job in earlier versions
of bash, you have a few alternative options.  You can create a named
pipe, and have a "regular" background job (one launched with & after it)
write to that.  Then you can use wait on the job's PID afterward.

Or, if you still want to use a process substitution, you can have it
write its exit status to a temporary file, and then retrieve the value
from the temporary file in the main script.



reply via email to

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