If I run a command in the background with
&, like this:
sleep 2 &
when the command finishes, I get "Done". How I can avoid seeing the "Done" message ?
migrated from stackoverflow.com Jul 4 '11 at 3:45
This question came from our site for professional and enthusiast programmers.
Execute the shell built-in:
This works by turning off "monitor mode" so the shell doesn't report terminating background jobs.
Although running the command in a subshell like:
...will also disable the message, the only reason it works is because monitor mode is enabled by default only for interactive shells. That is, the subshell avoid the message by running an extra shell that has an automatic "set +m".
I'd like to clarify the two earlier answers. If what you want is never to see the Done message from any commands in your shell,
and the sleep ends after the final
If you want to disable the message for a single command invocation, the subshell technique
In all honesty, I only knew about