4

Is there a way to hide the exit code of the background jobs that have finished?

For example, if I run:

sleep 5&

After the 5s, if I hit return the terminal gives me:

[1]+  Done                    sleep 5

Is there a way to hide/suppress the last notification?

Particulary I have to do this: nohup script >> file.txt & And after that I don't want anything more on the terminal (stdout)

1
  • Have you tried just passing the stdout output to /dev/null? Aug 24, 2015 at 18:25

2 Answers 2

7
$ sleep 5 &
[1] 1234
$ disown
1
  • 1
    or: sleep 5 & disown
    – Peter.O
    Aug 24, 2015 at 21:48
1

A bigger hammer is to disable the "monitor mode" (job control) completely with set +m:

Normally vs. monitor mode disabled:

$ sleep 1 & sleep 2
[1] 5247
[1]+  Done                    sleep 1

$ set +m
$ sleep 1 & sleep 2
[1] 5249
$

But then you can't pull background processes back to the foreground either:

$ set +m
$ sleep 10 &
[1] 5251
$ fg
-bash: fg: no job control

You must log in to answer this question.

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