delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/18/20:58:02

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
Message-ID: <3AB568AB.8DD7917B@acedsl.com>
Date: Sun, 18 Mar 2001 21:02:19 -0500
From: "Matthew O. Persico" <persicom AT acedsl DOT com>
X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: 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>

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?

> 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


-- 
Matthew O. Persico
    
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area

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