delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/06/08/19:06:37

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A2D9947.1080606@aim.com>
Date: Mon, 08 Jun 2009 19:05:43 -0400
From: Mark Harig <idirectscm AT aim DOT com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090320)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: lennart DOT borgman AT gmail DOT com
Subject: Re: Bug in $PATH initialization?
X-AOL-IP: 205.188.169.200
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 the bash manual (in emacs: M-: (info "(bash) Bash Startup Files")):

"When Bash is invoked as an interactive login shell, or as a
non-interactive shell with the `--login' option, it first reads and
executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile',
`~/.bash_login', and `~/.profile', in that order, and reads and
executes commands from the first one that exists and is readable.  The
`--noprofile' option may be used when the shell is started to inhibit
this behavior."

and

"When an interactive shell that is not a login shell is started, Bash
reads and executes commands from `~/.bashrc', if that file exists.
This may be inhibited by using the `--norc' option."

So, in the typical case, when you start bash with '-i', it sources the
following files:
          /etc/profile   # which typically contains PATH initialization
          ~/.bash_profile  # or some other "login" file, such as ~/.profile
          ~/.bash_profile will usually source ~/.bashrc (the non-login code)

To avoid having these files read, start bash with '--noprofile' (if you wish
to avoid reading /etc/profile and ~/.bash_profile) and '--norc' (if you wish
to avoid reading ~/.bashrc.  Or, simply edit /etc/profile and ~/.bashrc,
where PATH is typically set to get PATH to have the ordering that you
want.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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