FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 06-22-2012, 07:39 PM
José Luis Segura Lucas
 
Default /etc/bash.bashrc instead ~/.bashrc

Hi all!

I have several computers with Debian installed. In all of them I have
unstable with, in some cases, some experimental packages.

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.

I add an "echo" on each files before sending you my problem to check
that the problem is the configuration file and not only a possible
misconfiguration on my ~/.bashrc file.

I tried with different users and all of them loads the same
configuration file (/etc/bash.bashrc). I didn't found any difference
between this /etc/bash.bashrc and my other /etc/bash.bashrc in my other
Debian installations...

Is there any other place where bash is configured and tell it to load
one config file or another?

I don't know what to do to fix this problem... any help will be very
appreciated.

Thanks in advance
 
Old 06-23-2012, 09:42 AM
Claudius Hubig
 
Default /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
 
Old 06-23-2012, 03:24 PM
José Luis Segura Lucas
 
Default /etc/bash.bashrc instead ~/.bashrc

Hello Claudius

El 23/06/12 11:42, Claudius Hubig escribió:
>
> 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

You are right: I have the ~/.profile file missing. I don't know how can
I miss this file, but it didn't exist at all. I copied this from another
computer and it works.

I don't remember to write or generate "by hand" this ~/.profile. Is it
created automatically?

Thanks for your answer, it was driving me crazy

Best regards
 
Old 06-23-2012, 04:49 PM
Chris Bannister
 
Default /etc/bash.bashrc instead ~/.bashrc

On Sat, Jun 23, 2012 at 05:24:59PM +0200, José Luis Segura Lucas wrote:
> You are right: I have the ~/.profile file missing. I don't know how can
> I miss this file, but it didn't exist at all. I copied this from another
> computer and it works.

tal% less .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

--
"If you're not careful, the newspapers will have you hating the people
who are being oppressed, and loving the people who are doing the
oppressing." --- Malcolm X


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20120623164932.GB14371@tal
 
Old 06-23-2012, 05:12 PM
Claudius Hubig
 
Default /etc/bash.bashrc instead ~/.bashrc

Hello José,

José Luis Segura Lucas <josel.segura@gmx.es> wrote:
> I don't remember to write or generate "by hand" this ~/.profile. Is it
> created automatically?

It should be created automatically from the files in /etc/skel/ if
you are using useradd or adduser (the former with the --create-home
option).

Best regards,

Claudius
--
Monday is an awful way to spend one seventh of your life.
http://chubig.net telnet nightfall.org 4242
 

Thread Tools




All times are GMT. The time now is 04:25 AM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org