delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/19/07:03:39

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: <3AB5F580.BE9567F2@yahoo.com>
Date: Mon, 19 Mar 2001 07:03:12 -0500
From: Earnie Boyd <earnie_boyd AT yahoo 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 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> <3AB4C4EC DOT 8C8E71D4 AT yahoo DOT com> <3AB568AB DOT 8DD7917B AT acedsl DOT com>

"Matthew O. Persico" wrote:
> 
> Earnie Boyd wrote:
> >
> > "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.
> 
> Well, that's just about the most coherent explanation I've ever heard
> and if I stretch my brain, it jibes with what I think I've been reading,
> just a hell of a lot more simple.
> 
> One last point; non-login execution is any bash script/binary executable
> called from the command line or inside another script/executable, yes?
> 

Yes, anything that causes bash to fork.  Also, if you start bash from
the command line without the --login switch it is a non-login shell.

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