Score:1

bash: `set +m` option does not work when placed in the .bashrc file

it flag

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?

Score:0
in flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.