Shell scripting - suppressing and eliminating error messages

Paul Schmehl pauls at utdallas.edu
Tue May 20 22:54:16 UTC 2008


--On Tuesday, May 20, 2008 17:36:26 -0500 Paul Schmehl <pauls at utdallas.edu> 
wrote:

> I'm using the following construction in a pkg-deinstall script for a port I
> maintain:
>
> if ( ${BATCH} ); then
>
> The idea is, if you type make BATCH=1 deinstall, the port will deinstall
> without running an interactive portion of the pkg-deinstall script.  If you
> type make deinstall, the pkg-deinstall script runs.
>
> The script works, but, when you use BATCH=1, it generates an error message:
>
># make BATCH=1 deinstall clean
> ===>  Deinstalling for security/sguil-server
> ===>   Deinstalling sguil-server-0.7.0_1
> Stopping sguild......
> sguild not running?
> 1: not found
>
> Why is this error printing to stdout and how can I suppress it?  Or is there
> a flaw in the logic that, if fixed, would resolve this problem?

Never mind....forgot to use [ ] for test instead of ( ).  My perl is getting in 
the way of my shell. :-(

-- 
Paul Schmehl
As if it wasn't already obvious,
my opinions are my own and not
those of my employer.



More information about the freebsd-questions mailing list