shopt-option

checkjobs shell option

When an interactive shell with running jobs is asked to exit, lists job status and postpones the first exit; a second immediate exit can proceed. Stopped jobs already trigger warnings. Inspect and wait for owned jobs rather than relying on this option. Fixture checks state only. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): enabled then disabled.

Formal Syntax & Structure

bash syntaxbash
shopt -s checkjobs; shopt -u checkjobs

Return Value

exit status

Setting or clearing an available option succeeds; a query returns zero when enabled and one when disabled.

Working Example

Example Snippetbash
shopt -s checkjobs || exit 1shopt -q checkjobs || exit 1shopt -u checkjobs || exit 1if shopt -q checkjobs; then exit 1; fiprintf "enabled then disabled\n"
Bash Reference