If I enter the command:

set +m

at the end of the .bashrc file, when I run the command:

echo $-

the option m is missing as it should be, but...

If I enter the command:

{ sync & } 2> /dev/null

and then I press enter again without entering any commands, although I removed the m option, the output still appears:

[1]+  Done                    sync

and only when I rerun the command from the terminal:

set +m

then the output is no longer shown. In other words, this command has effect only if executed from the terminal.

The question is:

How do I make it work when placed in .bashrc file?

1 Answer 1


Got it!.. It will work if you put it in as export PROMPT_COMMAND='set +m'. You could use set -o monitor also.

This probably needs a bug report. I found one for Cygwin: https://cygwin.cygwin.narkive.com/PdJFe7Q6/bash-monitor-mode-remains-enabled-if-disabled-in-bashrc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.