On 6/8/06, John Oliver <[EMAIL PROTECTED]> wrote:
On Thu, Jun 08, 2006 at 09:06:22AM -0700, Gregory K. Ruiz-Ade wrote:
>
> # Put grep's return code someplace safer than $?
> rc=${?}
>
> if [ ${rc} -eq 0 ]; then
> # we found what we wanted
> # do X
> else
> # we didn't find what we wanted
> # do Y
> fi
Maybe better style:
# Put grep's return code someplace safer than $?
rc=${?}
case $rc in
0)
# we found what we wanted
# do X
;;
*)
# we didn't find it
# do Y
;;
esac
Not really evident as good style if there are only two cases (0 and
everything else). Shows to great advantage if there are more than two
cases to consider.
carl
--
carl lowenstein marine physical lab u.c. san diego
[EMAIL PROTECTED]
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list