To create a new interactive bash shell I call bash -i
. Due to issues with my environment, bash cannot assert job control (I'm using cygwin bash in GNU emacs) and issues warnings ("cannot set terminal process group" and "no job control in this shell"). - I have to live with the disabled job control in my environment, but I would like to get rid of the warning:
How can I tell bash not to assert job control and not to issue these warnings? I obviously still want the shell as an interactive one.
Note: I have tried set -m
in .bashrc
, but bash still writes out the warnings on start up - the ~/.bashrc
file might be executed after the shell tries to assert job control. Is there a command line option which would work?
man bash
says about set
options that The options can also be specified as arguments to an invocation of the shell. Note you will need +m
not -m
. Admittedly the manual isn't quite clear on that.
However looking at bash
source code (version 4.2), apparently it ignores the state of this flag. I would say this is a bug.
Applying the following small patch makes bash
honor the m
flag on startup. Unfortunately this means you will have to recompile bash
.
--- jobs.c.orig 2011-01-07 16:59:29.000000000 +0100
+++ jobs.c 2012-11-09 03:34:49.682918771 +0100
@@ -3611,7 +3611,7 @@
}
/* We can only have job control if we are interactive. */
- if (interactive == 0)
+ if (interactive == 0 || !job_control)
{
job_control = 0;
original_pgrp = NO_PID;
Tested on my linux machine where job control is available by default, so the error messages you see on mingw are not printed here. You can still see that bash honors the +m
now, though.
$ ./bash --noprofile --norc
$ echo $-
himBH
$ fg
bash: fg: current: no such job
$ exit
$ ./bash --noprofile --norc +m
$ echo $-
hiBH
$ fg
bash: fg: no job control
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With