This is the mail archive of the
mailing list for the Cygwin project.
Re: Bash scripts may misbehave if SHELLOPTS is exported and 'monitor' is enabled
-----BEGIN PGP SIGNED MESSAGE-----
According to David Picton on 1/3/2007 6:44 AM:
> It turned out that the problem has something to do with the 'monitor'
> option being enabled. Normally it would be turned off in
> noninteractive scripts, but if SHELLOPTS is in the environment the
> setting (turned on by interactive shells) gets propagated to all
Correct. The propagation of SHELLOPTS from an interactive to script
environment makes scripts behave much more interactively, which they
generally do not expect. I'll look into seeing if it is worth teaching
bash that certain SHELLOPTS should be ignored in a non-interactive setting
(it seems like emacs, vi, histexpand, history, ignoreeof, and notify also
> The bug disappears if:
> 1. I keep SHELLOPTS out of the environment, or
> 2. I change /bin/nroff to use /bin/ash instead of /bin/bash, or
> 3. I disable the monitor option (set +o monitor) before invoking man
All good workarounds; maybe when I next release bash I should be more
clear that exporting SHELLOPTS should be reserved for something done in a
top-level shell script that invokes other shell scripts, rather than in an
interactive session that invokes shell scripts, since exporting
interactive options to shell scripts has surprising effects.
Don't work too hard, make some time for fun as well!
Eric Blake email@example.com
volunteer cygwin bash maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html