Re: .bashrc vs .bash_profile: sourcing scripts
From: Bit Twister (BitTwister_at_localhost.localdomain)
Date: Fri, 08 Oct 2004 02:09:25 GMT
On 7 Oct 2004 18:49:35 -0700, email@example.com wrote:
> Hi All!
> I am running RH9 and use bash through Konsole all the time.
> I have found that whenever I open Konsole or su from a Konsole session
> to any other user, .bash_profile is source/executed/? but .bashrc
> never is.
Hmm, thought .bash_profile sourced. Example:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc <==================
# User specific environment and startup programs
> This has led me to source .bashrc from .bash_profile and comment out
> code in .bashrc that sources .bash_profile.
See above copy from /etc/skel which is copied into new accounts
during account creation.
> More recently, I had to shift code that sources a script (that sets
> other environment variables) to my .bashrc because it wasn't working
> when I had it in .bash_profile.
Usually .bash_profile is only sourced during login spinning up another
terminal or xterm does not execute .bash_profile but does source .bashrc.
Now, the new session inherits environment variables which have been
exported from the parent process.
> Have I got the wrong idea about these files? Am I the only one who has
> had to change default code to get my system to work? :)
not me. Maybe there is a bug in .bashrc. turn on tracing and see what
you can see
at the top of .bashrc and
at the bottom to prove everything ran correctly. To test do a
su -l $LOGNAME and watch what happens.