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

Re: /etc/bash.bashrc instead ~/.bashrc



Hello José,

José Luis Segura Lucas <josel.segura@gmx.es> wrote:
> In one (and only one) of then, when I open a terminal or connect by SSH,
> my bash load the default system configuration from /etc/bash.bashrc,
> instead of reading, as usual, ~/.bashrc.
> 
> I can think that I don't really have a ~/.bashrc (or have a mispelling
> on the file name), but if I run bash from the terminal, my configuration
> file in ~/.bashrc is loaded.

From man bash:

       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.

       When a login shell exits, bash reads and executes commands
       from the file ~/.bash_logout, if it exists.

       When an interactive shell that is not a login shell is
       started, bash reads and executes commands
       from /etc/bash.bashrc and ~/.bashrc, if these files exist.
       This may be inhibited by using the --norc option.  The
       --rcfile file option will force bash to read and execute
       commands from file instead of /etc/bash.bashrc and ~/.bashrc.


I guess that the SSH connect is a login shell, while the terminal is
not a login shell (especially if you run it manually).

Hence, if you connect with SSH, Bash will run /etc/profile and
~/.profile. My ~/.profile has a section like the following:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

which is also in the .profile in /etc/skel/, I therefore assume that
this is currently shipped with Debian.

I suggest you check whether these files (/etc/profile, ~/.profile,
~/.bash_profile) exist and whether they load ~/.bashrc.

Best regards,

Claudius
-- 
Cat, n.:
	Lapwarmer with built-in buzzer.
http://chubig.net                          telnet nightfall.org 4242

Attachment: signature.asc
Description: PGP signature


Reply to: