<div dir="ltr"><br><div>I am experimenting a little with C. I wrote a small application that returns an integer value. The value can be any integer value, even negative.</div><div><br></div><div>However, when checking $? after running it, when my application returns -1, $? is 255. Is there a way to get around this? Some setting somewhere, perhaps?</div>
<div><br></div><div>I want to run my application from a script and then check for [ $? < 0 ] and things like that, but I can't do that if -1 is ”translated” to 255…</div><div><br></div><div>Someone compiled and tested my application in Windows (I don't have Windows myself) and he said that e correct values (-1, for instance) was detected by the shell.</div>
<div><br></div><div>Seems like Bash chop the return value to 8 bits unsigned int. Is this a Bash thing or does this happen with the other shells (zsh, ksh, tcsh etc.) as well?</div><div><br></div><div><br></div><div><br></div>
<div>Johnny Rosenberg</div></div>