PDA

View Full Version : Handling negative return code value in ksh


emilia
06-04-02, 11:31
I am running a third party program from within a korn shell script (aix 5.1).
The program returns zero, positive and negative return code values but the negative ones are represented as positive integers in the $? return code variable. For example -1 becomes 255, -2 becomes 254 etc.

My script needs to convey these return codes (to a calling process) as a true negative value (ie a value that that will actually test negative). Is there any way to do this (preferably within a shell script) ?

I hope someone can help

With Thanks

Emilia

WingMan
08-20-02, 05:22
can you do something like ... ??


integer i=254
integer ReturnValue=0

${ReturnValue} = ${i} - $?