3

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)

  • Have you tried just passing the stdout output to /dev/null? – Rick Chatham Aug 24 '15 at 18:25
6
$ sleep 5 &
[1] 1234
$ disown
  • 1
    or: sleep 5 & disown – Peter.O Aug 24 '15 at 21:48
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.