How to hide bash from displaying “Done” when a background command finishes

Dear nixcraft forum,

I have some commands looped on the bashrc… yes i have to suppress the output. So i do of course

$long_wait_command > /dev/null 2>&1

It really work but, when i do login on the terminal/creating new session… oh crap it wait it till finished.

So i insert & because it is waiting too long… looks great it works. But after i login an do some other command, on the shell report that the job command is done. How do I surpress/silent/hide the report to the shell that this job done?

Is this own command will help ? Will it be waiting till the job done or just remove the running job?

There are two options to hide “Done” message in Unix or Linux bash shell.

Subshell (method #1)

Try running command in subshell:

(command &)
sleep 3
# now Done will be hidden
(sleep 3 &)

I just prevented bash from displaying “Done” when a background command finishes executing. As you can see:

Bash monitor mode (method # 2)

Job control is enabled. This option is on by default. Background processes run in a separate process group and a line containing their exit status is printed upon their completion. For example, turn it off “Done” message:

set +o monitor

To turn it on again:

set -o monitor

Add above to your script.

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki