I just customized my .bashrc
to include the exit status of the last command, so I get fancy prompts like
☑ larsmans@host:~$
and I no longer have to re-run commands to see their exit status because I ran some other command in between. This uses $?
to determine the exit status. However, I noticed that when a command is backgrounded with Ctrl+Z, the shell also sets $?
, so I keep seeing
[1]+ Stopped vim
☒ larsmans@host:~$ echo $?
148
Is this 148
a magic pseudo-exit status that I should check for?
main()
(and thus returning garbage as exit status). Others have turned out creative, returning anything from the number of items processed through the number of errors found to some perceived severity of the problems encountered. Several "original" Unix comands returned garbage as the exit status.vi(1)
was a notorious example.