This is the mail archive of the
mailing list for the Cygwin project.
Re: Changed handling of "!" in /bin/sh?
- From: Eric Blake <ebb9 at byu dot net>
- To: cygwin at cygwin dot com, luke dot kendall at cisra dot canon dot com dot au
- Date: Tue, 16 Jan 2007 20:18:10 -0700
- Subject: Re: Changed handling of "!" in /bin/sh?
- References: <20070117015312.43811842EF@pessard.research.canon.com.au>
-----BEGIN PGP SIGNED MESSAGE-----
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.
> 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.
> 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?
> 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
> set +o history
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
> 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
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.
Don't work too hard, make some time for fun as well!
Eric Blake email@example.com
-----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