I was thrown off guard today by gdb
:
Program exited with code 0146.
gdb
prints the return code in octal; looking into why I found:
http://comments.gmane.org/gmane.comp.gdb.devel/30363
But that's not a particularly satisfying answer. Some quick googling did not reveal the history, so I was hoping someone on SO might know the back story.
A somewhat related question, how would one even view the return code in octal? Perhaps older machines always printed the return code?
$ printf %o\\n $?
Is pretty awkward :)
$?
is the shell's value for return code, and is a decimal digit (or does gdb support your example cmd also?). Don't know why gdb reports it in octal. My solution is to get out the 'olman ascii
to see what the octal values mean. Interesting question, as you do run into octal values from other programs too. Maybe it is discussed in Kernighan and Pike's 'Unix Programming Envioronment'. Good luck.man ascii
would be of no use to convert octal to decimal.bc
would be a better choice.