delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/18/09:23:57

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Apparently-From: <earnie?boyd AT yahoo DOT com>
Message-ID: <3AB4C4EC.8C8E71D4@yahoo.com>
Date: Sun, 18 Mar 2001 09:23:40 -0500
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: Earnie Boyd <cygwin AT cygwin DOT com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: "Matthew O. Persico" <persicom AT acedsl DOT com>
CC: cygwin <cygwin AT cygwin DOT com>
Subject: Re: Bash is backwards, or I can't read a man page.
References: <3AB2D6D0 DOT 412200CA AT acedsl DOT com>

"Matthew O. Persico" wrote:
> 
> According to what I get from the manpage, the order of execution for a
> login shell should be:
> 
> /etc/profile
> ~/.bash_profile
> ~/.bashrc
> 
> When I login, I see
> /etc/profile
> ~/.bashrc
> ~/.bash_profile
> 
> because /etc/profile tests for ./.bashrc and runs it itself.
> 
> Is this a bug or a feature? Does someone have a clearer explanation of
> what stuff goes into .bash_profile and what goes into .bashrc and when
> they get called? Maybe it's just me - I can't grok this in ksh using the
> O'Reilly book either.
> 

IMO, the test for ~/.bashrc should go into the ~/.bash_profile file. 
Bash doesn't grok the ~/.bashrc file during --login so it needs to get
sourced by a profile file.  Since more than one shell groks the
/etc/profile file then specifics for a particular brand of shell should
be kept to a minimum.  Once upon a time Cygwin only shipped with one
interactive shell, so when setup.exe, which is what creates /etc/profile
in the first place, was created the designers chose to test for
~/.bashrc globally because it would cause less mail list traffic.

Now what should go in profile and what should go in bashrc?  The profile
should be used define variables and setup a login account that any shell
can grok.  The bashrc should contain bash specific things such as
aliases.  Note the /etc/profile and ~/.bash_profile isn't read during
non-login execution because those things should be passed to the child
while alias won't be.

For further reading check out the info file in /usr/info.

Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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