Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 $?

Is this 148 a magic pseudo-exit status that I should check for?

share|improve this question
I'm sure I'm not the only one guilty of just falling off the end of 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. – vonbrand Jan 22 '13 at 19:53
up vote 6 down vote accepted

Found it just before hitting the "ask question" button. I looked at the ABS, which suggests this is exit code 128 + signal SIGTSTP (even though no process exited). I then found out I inspect check the exit status using

kill -l $?

which reports TSTP, or "stop typed at tty", for 148.

share|improve this answer
You don't have to apologise for answering your own question :-) Such things are encouraged on the Stack Exchange network. – Chris Down Jan 22 '13 at 16:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.