3

When I'm in the terminal (either iTerm or Terminal.app) and have jobs running in the background, then typing exit or logout gives me:

There are stopped jobs.

which is fine and expected. The problem is that if I run exit or logout again (and repeatedly), I get the same thing.

isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.
isbadawi@astaire:~$ exit
logout
There are stopped jobs.

I've used bash on linux, and the behavior there was for the second invocation of exit or logout to go ahead and terminate the stopped jobs. Instead, I have to do this manually. Why is the behavior different, and is there a way to make it the same?

  • I can't reproduce it in a 10.9 VM, so check your configuration files. You could also try to install a newer version of bash by for example running brew install bash;echo /usr/local/bin/bash|sudo tee -a /etc/shells;chsh -s /usr/local/bin/bash. – Lri May 2 '14 at 13:36
  • @LaurieRanta Upgrading bash (to 4.3.11 from the system 3.2.51) seems to have fixed it! – Ismail Badawi May 2 '14 at 21:10
4

If you have jobs that are stopped (with CTRL-z) or happened to be in the background but are stopped waiting for input, you can see what's there with the 'jobs' command.

If you only have a job, then a 'fg' will bring it to the front for you to interact with it or kill with a 'CTRL-c'. If you have multiple jobs, you can bring individual or specific ones with 'fg '.

  • I know about job control (this is what I was referring to by "do this manually"). I am asking why bash seems to behave differently on OS X and Linux in this instance. – Ismail Badawi Apr 30 '14 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .