This is the mail archive of the cygwin@sources.redhat.com 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]

Re: odd bash wrapping due to ansi codes


At 05:40 9/18/00 -0700, Earnie Boyd wrote:
>--- Chris Abbey <cabbey@bresnanlink.net> wrote:
> > if [ "$SHELL" != "/bin/bash" ]; then
> >       test -f ./.profile && . ./.profile
> >       test -f ./.bashrc && . ./.bashrc
> > fi
> >
> > this has the advantage for those who run bash of not
> > sourcing these files twice, as bash does so itself.
>
>No, it doesn't always.  If --login then ./.bashrc is not performed but
>./.profile is, and without --login ./.bashrc is performed but not ./.profile.
>Also, without --login the /etc/profile isn't performed and shouldn't be a
>concern.

ok, my head hurts now. This explains why when I forget that the
cmd shell I'm in didn't start from bash that bash looks wierd when
I start it....

iow in bash.exe:
if (args.contains("--login")) {
     source = {"/etc/profile", "~/.profile"};
} else {
     source = "~/.bashrc";
}

ANYWAY... the circumstance I'm concerned with was the default bash
shell that comes up when the user clicks on that funky little Cygwin
icon on their desktop. So '--login -i' are the arguments; in which
case the pattern is:

/etc/profile sources ~/.profile
/etc/profile sources ~/.bashrc
bash sources ~/.profile

(I guess since I don't have a ~/.bashrc I never noticed it
wasn't being run twice. ;)

In which case I'd think the 'fi' element in my changed /etc/profile
can move up one line:

if [ "$SHELL" != "/bin/bash" ]; then
     test -f ./.profile && . ./.profile
fi
test -f ./.bashrc && . ./.bashrc


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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