This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

Re: .bashrc not getting sourced?


> My question is pretty simple:  is editing the /etc/profile the
> recommended way to get my ~/.bashrc file sourced?

I say: no.

>  And if not,
> what is.
>
> It should be noted that I found a message by Gary R. Van Sickle
> suggesting that .bash_profile might be a better way to do things,
> but this doesn't directly answer my question.

Yeah, well, that guy doesn't know what the heck he's talking about half the
time ;-).  Here's how I have things set up, and I recommend it to everyone;
it seems to be the way bash was intended to work, and I can't see any flaws
in the scheme:

1.  /etc/profile does not source any .bash* files.  It does do a bunch of
things like "USER="`id -un`"", set the HOME var, and runs any scripts in
/etc/profile.d/ (not entirely sure what that's about), all of which was
setup by setup.exe.
2.  .bashrc is empty.
3.  .bash_profile sources .bashrc (just in case, for future use), and then
contains all my env var settings, aliases, etc.
4.  PATH is *not* set in any of these files, but rather in the normal
Windows way (control panel on NT+, ??? on 9x).

So what you get with all this is:

1.  PATH is always good, whether you're running cygwin apps from bash or the
Windows "command line", and regardless of how bash is invoked
(interactive/login or not).
2.  When you start bash (interactively, your shell), it runs /etc/profile
and sets up the bare minimums and cd's to HOME.
3.  After runing /etc/profile, bash looks for ~/.bash_profile and runs it to
set up your user stuff.
4.  Subshells end up sourcing nothing (no BASH_ENV is defined anywhere), so
scripts run faster.
5.  Interactive but non-login shells run an empty .bashrc.  I don't know
when you'd get an interactive but non-login shell, but I haven't noticed any
problems to date.

--
Gary R. Van Sickle
Braemar Inc.
11481 Rupp Dr.
Burnsville, MN 55337


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]