delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/11/10:06:41

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B741CEB.6070706@towo.net>
Date: Thu, 11 Feb 2010 16:06:19 +0100
From: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: .bashrc file not run
References: <244882 DOT 68384 DOT qm AT web34508 DOT mail DOT mud DOT yahoo DOT com>
In-Reply-To: <244882.68384.qm@web34508.mail.mud.yahoo.com>
X-IsSubscribed: yes
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

On 11.02.2010 15:55, Neil Blue wrote:
> Hello,
>
> This problem has me stumped.
>    
Me too, a while ago.

> ...
> When I login, the environment settings I put in .bashrc don't get run.
> If I source ~/.bashrc they are included as expected.
>
> Also I have added some configuration to /etc/bash.bashrc it does not get run.
> ...
>    
By design (and documentation), bash runs *only* .profile (and 
/etc/profile) if started as a "login shell".
It runs .bashrc (and /etc/...) only if *not* started as a login shell.
You may be used to different behaviour because on typical Linux systems, 
~/.bashrc (and /etc/...) is called from /etc/profile.

The personal remedy is to call ~/.bashrc from ~/.profile.
In order to keep a portable .profile, it's a good idea to guard that 
with some variable you set in .bashrc (e.g. $_HOMEBASHRC as on SUSE Linux),
so it's not called twice on Linux.

I don't know whether all Linux distributions do that in /etc/profile;
if so, following the general approach to increase compatibility with 
Linux, would it be a good idea to consider it for cygwin too?

Thomas

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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