delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/03/26/14:46:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Gary R Van Sickle" <tiberius AT braemarinc DOT com>
To: "Cygwin Mailing List (E-mail)" <cygwin AT sources DOT redhat DOT com>
Subject: Re: .bashrc not getting sourced?
Date: Tue, 26 Mar 2002 13:45:50 -0600
Message-ID: <002301c1d4fe$d59b48f0$2101a8c0@BRAEMARINC.COM>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019