This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Changed handling of "!" in /bin/sh?


-----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.

> 
> 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
>     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.

> 
> 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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----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

iD8DBQFFrZVy84KuGfSFAYARAlDXAJ40BcktrqqE9cy+/h3evOpIPcYnWQCgtETx
U9HyPHcoWCC/3orb9KCPdaU=
=zx7J
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]