On Tue, Dec 11, 2012 at 2:49 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote:
> Since coproc creates a background job, it doesn't really makes sense that > the "coproc" command itself would know the exit status of the background > job. It would have to wait for the background job to terminate first, > which would defeat the whole purpose. > > So, I'd just call it a documentation flaw. Most likely "coproc" is > indicating whether it successfully created the coprocess (bg job), and > you'll have to use "wait" to fetch its exit status once it becomes > available. > This I completely agree with. It may indeed be a documentation flaw, but whether or not the process was launched correctly would be a nice thing to know anyway. Regardless, it shouldn't always fail when within an if statement. The main issue I have is the fact that the "NAME_PID" variable disappears. After a little more experimentation, it always seems to work with bash -i. Job control doesn't appear to be the culprit, though, as it doesn't work when run with bash -m.