Bash – Clarification for Bash documentation on disown builtin option -h

bashdisownjob-controlsignals

According to the documentation:

To prevent the shell from sending the SIGHUP signal to a particular
job, it should be removed from the jobs table with the disown builtin
or marked to not receive SIGHUP using disown -h.

https://www.gnu.org/software/bash/manual/html_node/Signals.html

Note the OR in the quote.

I can confirm that simply using disown without -h and re-logging that the process did not exit:

#!/bin/bash

( sleep 10s; echo 1 > b ) &
disown

It seems that the -h option is not necessary? If it works without then what is its purpose?

Best Answer

Without -h the job is removed from the table of active jobs, with -h it is not.

Everything is in the manual:

 disown [-ar] [-h] [jobspec ...]

       (...)
       If the -h option is given, each jobspec is not removed
       from the table, but is marked so that SIGHUP is not sent to the
       job  if  the shell  receives  a SIGHUP.

To see the difference run jobs after disowning the job with and without -h.

Related Question