<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] when using `which` send errors to /dev/null



=- Luciano Rocha wrote on Wed 23.May'07 at 18:48:01 +0100 -=

> when using `which` send errors to /dev/null
> {...}
> -if test -x "`which md5`"
> +if test -x "`which md5 2> /dev/null`"

On solaris 8 which produces noise on STDOUT, not STDERR.
Maybe the attached version suits all.

-- 
© Rado S. -- You must provide YOUR effort for your goal!
EVERY effort counts: at least to show your attitude.
You're responsible for ALL you do: you get what you give.
--- morg/hcachever.sh   Fri Apr  6 09:00:11 2007
+++ mgo/hcachever.sh    Wed May 23 20:07:50 2007
@@ -2,6 +2,7 @@
 
 BASEVERSION=1
 
+{
 if test -x "`which md5`"
 then
   MD5=md5
@@ -12,9 +13,10 @@
 then
   MD5="openssl md5 -hex"
 else
-  echo "ERROR: no MD5 tool found"
+  echo "ERROR: no MD5 tool found" >&3
   exit 1
 fi
+} >>/dev/null 2>&1 3>&2
 
 cleanstruct () {
   echo "$1" | sed -e 's/} *//' -e 's/;$//'