OT scripting question
chbaker at powersystems.rockwell.com
chbaker at powersystems.rockwell.com
Mon Apr 28 20:53:00 CEST 2003
If you are using the korn shell, #!/bin/ksh, the exit value of the previous
command is stored in
''$?'' w/o the quotes. The same special variable works in perl but it may
have the last status
value returned from the last system, pipe close, or back tick ( ex. `date
+%Y%m%d` )
command.
Charles H. Baker
chbaker at powersystems dot rockwell dot com
work: 864.281.2409 fax: 864.281.2487 cell: 864.363.5302
BOFH excuse #341:
HTTPD Error 666 : BOFH was here
Jeff McKeon <jsm at inpro.net>
Sent by: To: Nagios List <nagios-users at lists.sourceforge.net>
nagios-users-admin at lists.sour cc:
ceforge.net Subject: [Nagios-users] OT scripting question
04/28/2003 01:19 PM
hell all,
I know this is sort of off topic but it's for a script I'm writing to
use with nagios so I beg forgiveness..
When using a command like grep that returns an exit status (0 for match,
1 for no match, 2 for errors) how i use that exit status in a script.
In other words, what variable is assigned the 0, 1 or 2?
So if i had:
# look for "hello" in /tmp/somefile
/bin/grep -q hello /tmp/somefile
/bin/echo (exit status)
what would I replace "(exit status)" with so that it would echo the 0, 1
or 2?
thanks
--
Jeff McKeon <jsm at inpro.net>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list