12.7 Stop Background Output with stty tostopIf you put a job in the background (1.26 ) and don't redirect (13.1 ) its output, text that the job writes to its standard output and standard error will come to your screen. Those messages can mess up the screen while you're using another program. You could lose the (maybe important) messages, too - they might scroll off your screen and be lost, or your foreground program may clear the screen and erase them. Most BSD UNIX systems, and a lot of newer UNIXes with job control, have the command stty tostop . Type that command at a prompt, or put it in your .login or .profile file (2.1 ) .* [2] After that, your shell's background jobs that try to write to your terminal will be stopped. When you want to see the background job's output, bring it into the foreground (with fg ).
How will you know that the background job has been stopped? The shell will print a message like this just before it prints a prompt: [1] + Stopped (tty output) The shell can also interrupt your foreground job with that message as soon as the background job is stopped. To make it do that, set notify (12.6 ) . You can turn off this feature and let background jobs write to your terminal any time with the command: % Article 41.2 has more about stty . - |
|