if I make
sleep 2 &
this command run in backgroung, and in two seconds, I get "Done".
How I can avoid seeing the "Done" message ?
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