redirecting command output depending on exit status

Riaan Kruger riaank at gmail.com
Thu Apr 21 08:07:35 UTC 2011


>
> > I have a cron task set up using lockf.
> >
> > I'd like to redirect one exit status to /dev/null :
>
I think that the exit status of a command will be after any output of the
command to stderr or stdout.  So first it will say "This is wrong" and then
it will exit giving you the exit code.

The only thing I can think of is to write a wrapper script which in effect
parses out the error message  for example:
command | grep -v "offending message" > logfile

Regards
Riaan


More information about the freebsd-questions mailing list