Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I run a process in the background the process ID gets displayed in the command prompt. For example:

$ gvim 1 &

[3] 9584

Now when I run another process the state of the previous one also gets displayed. For example:

$ gvim 2 &

[4] 9500

[3]   Done                    gvimBackground 1 

Is there any way I can suppress displaying the current PID and the data related to previous processes?

share|improve this question
add comment

2 Answers

It's not so much that the status of other jobs are reported when you start a new one, but that changes of status are by default only reported before a prompt is displayed. So in your case, it's reported at the first opportunity, that is at the prompt displayed after you start your second job.

You can make the job reporting synchronous by issuing:

set -b

In that case, reports on completion or suspension... of background jobs is done as soon as it happens and you don't have to wait for the next prompt.

If you don't want to be notified of the completion of a job, as @Scott says you can start it as a job of a subshell (job &), or disown it using the disown command (or with zsh, start it as job &!) but note that it means you can't put it back in foreground or kill it using a job number.

share|improve this answer
add comment

Put your entire command, including the &, in parentheses:

 (prompt)$ gvim 1 &
[3] 9584
 (prompt)$ some other command
[3] Done gvimBackground 1
 (prompt)$ (gvim 1 &)
                                                                <– (silence)
 (prompt)$

share|improve this answer
add comment

Your Answer

 
discard

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.