This is the mail archive of the
mailing list for the Cygwin project.
Re: Changed handling of "!" in /bin/sh?
- From: Luke Kendall <luke dot kendall at cisra dot canon dot com dot au>
- To: cygwin <cygwin at cygwin dot com>
- Date: Wed, 17 Jan 2007 15:17:15 +1100 (EST)
- Subject: Re: Changed handling of "!" in /bin/sh?
On 16 Jan, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> According to Luke Kendall on 1/16/2007 6:53 PM:
> > Do you mean, like adding set +o history into /etc/profile? Er, but
> > that would turn it off for interactive use. And if I set igncr so that
> > everything can see it then it has a side effect of exporting the
> > SHELLOPTS, so then the automatically set options are of course in the
> > env so they affect every sub shell.
> > Ouch!
> > It seems like I'm in a catch 22 situation.
> Yes, unless I can come up with a patch that makes bash smarter about which
> SHELLOPTS options it will pay attention to when started non-interactively.
Okay, then I understand.
But you've also given us two or three other solutions, too!
> > I have "\\samba\x" mounted as "X:", a textmode mount. But (to avoid
> > having "x:/cygnus" in my ":"-separated PATH), I have "//samba/x/cygnus"
> > in my PATH.
> Why not put /cygdrive/x/cygnus in your path, then?
Good question! :-) It's mainly because we might use other Unix
environments too (Uwin or MKS or MS SFU <shudder>), and we'd like
everything as far as possible to use common names.
> > Sorry, let me see if I understand. We want igncr enabled, not disabled
> > (or the text mount idea above). By developer tools do you mean all the
> > scripts? I just read up on BASH_ENV: so I could have its script say:
> > if expr "$-" : ".*i" > /dev/null
> > then
> > :
> > else
> > set +o history
> > fi
> Or, more efficiently (fewer processes, and fewer lines):
> case $- in *i*) ;; *) set +o history ; esac
> > Or, copy /bin/ash.exe to replace /bin/sh.exe.
> Not recommended. The reason cygwin moved to bash as /bin/sh was to avoid
> ash bugs.
Okay, so that's out.
> > Please let me restate, to check I understand what you mean by "you ran
> > bash interactively first": you simply mean, I started an interactive shell?
> > (So that sees SHELLOPTS in the env because I put it there, then
> > the interactive shell options get set, which conflict with POSIX.)
> Yes - the fact that you ran bash interactively, and from that shell
> started the non-interactive scripts, explains why the non-interactive
> scripts inherited the SHELLOPTS set with interactive options.
> >> If you use /bin/sh as your login shell, then fewer options will be set in
> >> SHELLOPTS automatically.
> > Do you mean, change /etc/passwd so it's /bin/sh, and then change .profile
> > to exec bash?
> Or even change cygwin.bat to invoke sh instead of bash, if you use the
> default cygwin.bat created when you installed cygwin.
> > Anyway, I think I now have a few workarounds, thanks to your patient
> > explanations.
> I hope that the BASH_ENV option works out for you. I personally don't use
> CRLF line endings, so I don't have to worry about igncr in my daily use.
I'm actually planning to make sure all the PATH elements are mounted
text mode, since it seems more efficient (since there'd be a little
less overhead in forking shells).
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html