tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Named Pipes - possibly

shell problem under 2.6 ▻

Bullet proof way to find return codes

In article <37590aa4.125076296@news.mindspring.com>,
Robert Chung <robertch@mindspring.com> wrote:
>I run many things such as `ps -ef | grep something | tee somefile`.
>Problem is, I need to find return codes from individual commands, ie

In rc, a pipeline returns an exit status which is a list.  For example,
the command `who |wc' normally sets $status to the list `(0 0)'; whereas
`echo foo |grep bar' sets $status to `(0 1)'.

>'somecommandY &' ".  somecommandX and somecommandY will terminate at
>unknown time in future, and I need to capture their individual return
>codes also.

Depends if you can afford to `wait' for them; I'm not aware of any
shells that offer non-blocking waits.

Tim.
--
Tim Goodwin   | `I can't believe that someone is releasing
University of | something called "Unix" without something
Leicester, UK | called "/bin/sh".' -- Randal L. Schwartz

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Bullet proof way to find return codes
Date: 7 Jun 1999 12:34:21 +0100
Organization: University of Leicester, UK
Message-ID: <7jgant$t6t$1@ltpcg.star.le.ac.uk>
References: <37590aa4.125076296@news.mindspring.com>

△ comp.unix.shell △

◅ Named Pipes - possibly

shell problem under 2.6 ▻