Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: Shell script Q
- To: tlug@example.com
- Subject: Re: Shell script Q
- From: "Thomas O'Dowd" <tom@example.com>
- Date: Wed, 9 Aug 2000 11:57:44 +0900
- Content-Disposition: inline
- Content-Type: text/plain; charset=us-ascii
- In-Reply-To: <20000809113614.A8595@example.com>; from bennett@example.com on Wed, Aug 09, 2000 at 11:36:14AM +0900
- References: <20000809113614.A8595@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <Lc82yB.A.d2B.BqMk5@example.com>
- Resent-Sender: tlug-request@example.com
- User-Agent: Mutt/1.2.4i
You can check $? in bash so something like command_with_return_your_interested_in if [ $? -eq 101 ] ; then blahhh fi Remember to read $? right after running the command though as it is always the last command executed. If you will have multiple if statements it is better to capture the value first with a variable... something like ret=$? Cheers, Tom. On Wed, Aug 09, 2000 at 11:36:14AM +0900, Frank BENNETT wrote: > 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 () > > ----------------------------------------------------------------------- > Next Nomikai Meeting: August 18 (Fri) 19:00 Place: TBD > Next Technical Meeting: September 9 (Sat) 13:30 Place: LinuxProbe Hall > ----------------------------------------------------------------------- > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan >
- References:
- Shell script Q
- From: Frank BENNETT <bennett@example.com>
Home | Main Index | Thread Index
- Prev by Date: Shell script A
- Next by Date: Re: How to use Japanese True Type fonts?
- Prev by thread: Shell script A
- Next by thread: apache config
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links