MLUG: Re: [MLUG] basic Unix pipe/exit code problem
Re: [MLUG] basic Unix pipe/exit code problem
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Oops - bash can use something like this:

   if [ $? == 0 ] ; then
       ...
   elif [ $? == 1 ] ; then
       ...
   else
      ...
   fi

My bad.  I knew I had done something like this before, but I couldn't 
remember the syntax.  There are about a million ways to do something in 
bash using standard command-line utilities...

   ryan woodsmall
     EMAIL:PROTECTED


> ###BEGIN###
>
>     #!/bin/bash
>     cmd1 | cmd2 | grep SOMETHING >/dev/null 2>&1
>     if [ $? == 0 ] ; then
>         echo found SOMETHING
>         exitcode=0
>     elif [ $? == 1 ] ; then
>         echo did not find SOMETHING
>         exitcode=1
>     fi
>     exit $exitcode
>
> ###END###

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members