Why doesn't my path update *now*?

I recently installed the newest Qt SDK and I went ahead and added it to my PATH inside of my ~/.bash_profile.

I don't see the change. I can source ~/.bash_profile but then my path is twice as long, yet I can't simply open a new gnome-terminal and have the path updated.

Why?

Notes: Fedora 11 running GNU bash, version 4.0.16(1)-release inside of default gnome desktop.

.bash_profile path config:

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/opt/qtsdk-2009.03/qt/bin/:/usr/local/lib/

When you just open a terminal from your desktop the terminal inherits the environment it was started in, including that PATH. When you open a terminal, the following happens according to the Bash documentation:

From the Bash Reference Manual

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.

And...

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. 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 ~/.bashrc.

So, typically, your ~/.bash_profile contains the line

 if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

after (or before) any login-specific initializations.

So in order to get your .bash_profile to execute you need to log into a login shell, perhaps by ssh-ing into the localhost, or by logging out of your desktop environment and logging back in..


Try putting that in your ~/.bashrc instead.

When you login, ~/.bash_profile is processed. It is not processed again when you open a new terminal or start a new shell, which is when ~/.bashrc is processed. You should source ~/.bashrc in your ~/.bash_profile.

See the "Invocation" section in man bash.