Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shell script Q



We have some APC power supplies here, and I want our Linux servers
to take advantage of them.  I fetched the upsd package, which looks
like it will do the trick.  The upsd daemon accepts an option that
causes it to exit immediately with a return status that indicates
what it deduced from the serial line it was pointed at -- power low,
no cable found, etc.

So, I thought, all I need to do is catch the return value, run it
through a case statement, and I'm ready to set things up.

But, uh, then I realized that I don't know how to catch a return value (as
opposed to standard output).  The only shell operators I know of that handle
return values are && and ||, and these are not going to help me distinguish
between return values of 100 and 101.

I know there's a way to do this, but I have been through the Bash man page
and I can't figure it out.

Can anyone help?

Thanks in advance,
----
-x80
Frank G Bennett, Jr         @@
Faculty of Law, Nagoya Univ () email: bennett@example.com
Tel: +81[(0)52]789-2239     ()

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links