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

Re: How to add a new dir to my PATH?



Dan Martins wrote:

On Sun, Feb 05, 2006 at 04:48:52PM -0800, Andrew Sackville-West wrote:
On Sun, 5 Feb 2006 19:43:00 -0500
Dan Martins <dan-martins@rogers.com> wrote:

On Sun, Feb 05, 2006 at 02:31:52PM -0200, Bruno Buys wrote:
I am trying to figure out which file I shall edit, in order to add an extra dir to my PATH ($HOME/bin). If I log on to my debian sarge in text mode, my .bash_profile is read. If I log right to X (kdm), it doesn't. The same happens to .bashrc.
Thanks!

~/.bash_profile should be read when the shell is opened as a login
shell, ie. from the console you enter username and password.

~/.bashrc should be read when a shell is opened through xterm, aterm,
Konsole, etc.

The easiest thing i've found is to add "source ~/.bashrc" to
.bash_profile and "export PATH="......"" to ~/.bashrc

The only reason i can think of not to do this is if your .bashrc and
.bash_profile set up your shell differently from each other. In my case
they're both empty except for changing my $PATH. If you run into trouble
I guess you could change your $PATH variable in a different file and
then source that file from both bash scripts.

Anyone see a problem with this?
fwiw, my system has no ~/.bash_profile and my ~/.bashrc sources /etc/profile which is the global profile.

Ok, but ~/.bashrc shouldn't be read from if bash is started as a login
shell, unless debian doesn't follow the invocation section of the bash
man page.

Sourcing ~/.bashrc from ~/.bash_profile, ~/.bash_login, or ~/.profile
ensures you have the same $PATH in your plain old terminals as you do in
X.

Dan
A

--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org




Seems like the only file being sourced was /etc/bash.bashrc. I added

. /etc/profile

to it, then

. $HOME/.bash_profile

to /etc/profile. Now my bash_profile gets read, always. It already has a test to check if I have a 'bin' dir on my home dir.

Apparently the issue is solved, so thanks for everybody's inputs. But it looks weird, to me. How come there's .bash_profile and .bashrc on my home, that aren't read when the systems loads right to X? Or, I can't set my env, when in X by any other means...



Reply to: