You are not logged in.

#1 2010-11-08 04:32:23

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Problem with .bashrc not being sourced at login

I'm having problems getting one of my systems to source my .bashrc file automatically during login.  I have tried everything that I know, but I may have over looked something. 

Here is my .bashrc file:

# Check for an interactive session
[ -z "$PS1" ] && return

alias ls='ls --color=auto'
PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '

I also have the following entry in my .bash_profile:

. $HOME/.bashrc

But when I manually source the .bashrc file it works just fine:

sh-4.1$ 
sh-4.1$ source ~/.bashrc
[vendion@Baduhena ~]$ 

As for any other details I'm sure it is not KDE doing this becaue when I log in on a TTY session the file still does not get sourced.

Last edited by vendion (2010-11-15 03:54:14)

Offline

#2 2010-11-08 04:46:26

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,785

Re: Problem with .bashrc not being sourced at login

How are you logging in? 
Are you in a terminal logging into a shell? 
Is bash the shell called out for your user in /etc/passwd? [Could it be zsh, csh, or rsh]
Are you using Slim, Kdm, Gdm or Xdm? [They don't invoke .bashrc, but rather .xinitrc, etc...]


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2010-11-08 05:54:30

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: Problem with .bashrc not being sourced at login

Have you tried putting:

. $HOME/.bashrc

in simply .profile (rather than .bash_profile)?

Offline

#4 2010-11-08 08:52:42

jowilkin
Member
Registered: 2009-05-07
Posts: 243

Re: Problem with .bashrc not being sourced at login

Do both ~/.profile and ~/.bash_profile exist?  If so try using only of the two.

Offline

#5 2010-11-13 02:04:27

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: Problem with .bashrc not being sourced at login

Where or how I log in does not make any difference, I have tried with both TTY sessions and KDM.   Yes I have bash set as my shell session.  I only have a ~/.bash_profile I can try to rename it to just ~/.profile.

Offline

#6 2010-11-15 03:42:55

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: Problem with .bashrc not being sourced at login

Ok so renaming .bash_profile to .profile seems to work in a TTY session, but it still is not working with KDE.  I don't know what I need to put in .xinitrc if there is anything that I need to, never had to do this before on any of my other systems.

Last edited by vendion (2010-11-15 03:55:52)

Offline

#7 2010-11-17 01:16:32

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: Problem with .bashrc not being sourced at login

This may sound like a stupid question, but in your .bashrc script, your checking for an interactive shell,  Doesn't it need to start with an if? and end with an end?

I am asking because, just suppose that the .bashrc file is being sourced like it should be, only, it is encountering that statement and quietly dieing at that point.

So, what happens if that -z line were commented out?


Knute

Offline

#8 2010-11-27 23:19:11

Leviathan1
Member
Registered: 2010-11-24
Posts: 19

Re: Problem with .bashrc not being sourced at login

Check how your terminal emulator in kde invokes the shell.
Is it starting bash as sh ? If you run it as sh it tries to mimic the old Bourne shell and doesn't read .bashrc.

And .profile or .bash_profile are only run when bash is started as a login shell. (for example by login, telnet or ssh).

Offline

Board footer

Powered by FluxBB