Helpful Information
 
 
Category: UNIX Help
negative exit

Hi all,

Is it possible to get a negative exit value on a shell script ?

my_script.com

/usr/bin/my_prog.exe
RESULT_EXIT=$?
echo $RESULT_EXIT
exit

My_prog.exe return (-1).
The echo gives me 255. why ?
Is i a way to get -1 or any other negative value, other than
RESULT_EXIT=`expr 254 - $?`

thanks.

you have .com and .exe files on unix? a very old version of SCO UNIX when it still belonged to Microsoft?

afaik unix programs return an int, i.e. usually a signed 32 bit value.
if your shell only supports unsigned bytes (0-255), i consider this a bug in your shell. as your unix seems to be quite old (10-20yrs?), imho you should really not deal with it at all anymore. although i never tested this behaviour on recent unices..










privacy (GDPR)