Thread: negative exit

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    1
    Rep Power
    0

    Question 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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    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..

IMN logo majestic logo threadwatch logo seochat tools logo