Adam Siler
Adam Siler

Reputation: 2026

Can I suppress background process info?

When I start a background process, Bash outputs the process ID. Then Bash outputs a status message when the process is complete. Here's what I mean:

$ echo foo &
[1] 12345
foo
$ echo bar
bar
[1]+ Done echo foo

Is it possible to suppress this information?

Upvotes: 1

Views: 119

Answers (3)

chaos
chaos

Reputation: 9282

You can disable notification by calling

set +m

before the command.

Upvotes: 0

Mark Setchell
Mark Setchell

Reputation: 207465

Use a sub-shell:

(sleep 2 &)

Upvotes: 2

pfnuesel
pfnuesel

Reputation: 15320

You could start it in a separate shell by

bash -c 'echo foo &'

but you would also have no jobcontrol.

You can also disable job monitoring by

set +m

then you don't have this message

[1]+ Done echo foo

but you still get

[1] 12345

Upvotes: 0

Related Questions