bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --rcfile still opening the SYS_BASHRC


From: Chet Ramey
Subject: Re: --rcfile still opening the SYS_BASHRC
Date: Sat, 16 May 2009 15:12:42 -0400
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

Lluís Batlle wrote:
> 
> I think I noticed SYS_BASHRC isn't sourced under "--rcfile" if bash
> 3.2 is not compiled with readline.
> I had scripts using this feature, and suddenly they started to fail
> when I used another bash (compiled with readline or ncurses).

I can't reproduce this.  A bash compiled without readline and SYS_BASHRC
defined behaves the same as a version compiled with readline included and
SYS_BASHRC defined.

>>> According to the manual, "--rcfile" should make bash avoid the system 
>>> bashrc.
>> I'm not sure which manual you mean.  The bash manual doesn't say anything
>> about SYS_BASHRC, since it's a feature that's not compiled in by default.
> 
> I agree. How do you suggest I can load an initialization file
> automatically (as with "--rcfile"), but without SYS_BASHRC being
> loaded?

The answer differs with the invocation circumstances, since the bash
behavior with loading startup files depends on how it is invoked.

If you want to keep bash compiled with SYS_BASHRC defined, and you
control the contents of SYS_BASHRC, you might want to change it so
it will not continue if a particular environment variable is defined:

if [ -n "$NOSYSBASHRC" ];then
        return
fi
[rest of /etc/bashrc goes here]

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]