Re: Status of sub-command
"John Gill" <[email protected]>
| Newsgroups | gmane.user-groups.linux.ottawa.general |
|---|---|
| Message-ID | <[email protected]> |
If you are using bash as the shell, check out the PIPESTATUS variable (see the man page for bash). John On Tue, Oct 14, 2008 at 4:44 PM, Jon Earle <[email protected]> wrote: > Hey folks, > > If I have a script command such as: > > ${CVS} ${CVSGlbOpts} update ${CVSUpdOpts} 2>&1 | ${GREP} -v ^? > > ${CVSResultsFile} || status=0 > > The obvious problem is that the 'status=0' is set by the status of the grep > command and not the cvs command. Originally, the commandline was coded > without the grep - I'm adding it to try and cleanup the log. > > How can I capture the status of the cvs command (ignoring the grep) and > still > process the output of the cvs command to reduce the logfile cruft? > > Cheers! > Jon > > -- > OCLUG general discussion list > [email protected] > http://oclug.on.ca/mailman/listinfo/oclug > -- OCLUG general discussion list [email protected] http://oclug.on.ca/mailman/listinfo/oclug