Exit return status > 127?

Exit return status > 127?

Post by Paul Martinolic » Sat, 23 Sep 2000 04:00:00



I seem to remember that I once came across a message that some shells
can not handle an exit status greater than 127.  Maybe this was
dependent
on the operating system.  Can anyone give an example where this is
true?

Thanks,

Paul
--
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Paul Martinolich/Software Engr.   e-mail:

Neptune Sciences, Inc.            voice: (228) 688-5280
NRL Remote Sensing/Ocean Color    http://www7240.nrlssc.navy.mil/ocolor/

 
 
 

Exit return status > 127?

Post by Jehs » Sat, 23 Sep 2000 04:00:00



> I seem to remember that I once came across a message that some shells
> can not handle an exit status greater than 127.  Maybe this was
> dependent
> on the operating system.  Can anyone give an example where this is
> true?

As far as I recall, when a process is killed, its exit status is 128 + the
kill signal. So if you kill something with ctrl-c (kill signal 2), its exit
status is 130.

Moshe

--

wreck.org bellsouth.net resnet.gatech.edu burdell.org yo.dhs.org gooning.org

usa.net; ICQ 1900670

 
 
 

Exit return status > 127?

Post by Paul Martinolic » Sat, 23 Sep 2000 04:00:00


Moshe,

Thanks!  That jogs my memory.  I just wrote a few small test programs
and
send the sleeping program a kill -9 and the shell script that was
running
it returned 137.  One of our programs was going to return the number of
files it created and I didn't think you could trust any number of 127.

Paul



> > I seem to remember that I once came across a message that some shells
> > can not handle an exit status greater than 127.  Maybe this was
> > dependent
> > on the operating system.  Can anyone give an example where this is
> > true?

> As far as I recall, when a process is killed, its exit status is 128 + the
> kill signal. So if you kill something with ctrl-c (kill signal 2), its exit
> status is 130.

> Moshe

> --

> wreck.org bellsouth.net resnet.gatech.edu burdell.org yo.dhs.org gooning.org

> usa.net; ICQ 1900670

--
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Paul Martinolich/Software Engr.   e-mail:

Neptune Sciences, Inc.            voice: (228) 688-5280
NRL Remote Sensing/Ocean Color    http://www7240.nrlssc.navy.mil/ocolor/
 
 
 

Exit return status > 127?

Post by brian hile » Mon, 25 Sep 2000 04:00:00




>> ...
> As far as I recall, when a process is killed, its exit status is 128 + the
> kill signal. So if you kill something with ctrl-c (kill signal 2), its exit
> status is 130.

Note that in the latest version of ksh (ksh93) the exit status is
256+<signal number>. This will break legacy scripts without modification.

-Brian

 
 
 

1. return status of commands run in su - <name> -c "<command>"

Hi

I was wondering how you can get the return status of a command which is run
within the context of su - <name> -c "<command>"

I am trying to find out the status of my command, but it always returns 0

su - dbsa -c "
$DB_DIR/dbinfo
echo $?
"

even if the dbinfo command fails, it will print out 0. Is there any way to
get the actual return status?

Note if I "su - dbsa" on the command line, run the command and have it fail,
it will return a non-zero return code.

Thanks

Ted

2. IP masquerading & Squid

3. "bash -c 'exit 5'" gives 127 !

4. Mail and ppp

5. 127.0.0.0 or 127.0.0.1?

6. Printing from UNIX to an NT printer

7. Which is correct for loopback, 127.0.0.0 or 127.0.0.1?

8. 2 questions about PPPD?

9. "bash -c 'exit 5'" gives 127 !

10. Wait returning 127 for process that is complete

11. ? Shell always returns error 127

12. Returning exit status

13. can a script return a value other than exit status