Answer the question
In order to leave comments, you need to log in
Commands from ~/.bashrc not working on login?
Comrades,
I use OpenIndiana, the shell is bash.
I tried to add the path to the binaries I needed to the $PATH variable by adding the following line to ~/.bashrc:
export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin:/opt/csw/bin:/opt/csw/gcc4
Answer the question
In order to leave comments, you need to log in
try adding to ~/.bash_profile
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
This is a feature and is described in the mana linux.die.net/man/1/bash
The point
is that ~/.bash_profile is read on login, and ~/.bashrc on interactive shell startup. It's very easy to check. We write the line echo 'bash_profile' to ~/.bash_profile , and echo 'bashrc' to ~/.bashrc . Now we log in and start another save shell (i.e. start bash without login):
bash_profile
[[email protected] ~]$ bash
bashrc
[[email protected] ~]$ exit
[[email protected] ~]$
In general, it's generally accepted to set PATH=$PATH:<your_paths>.
And, there is a bit of an opinion that it is better to store such things in a separate file, ala ~/.profile, and read it, rather than write it directly to bash_*. Why - so that in other shells (well, suddenly you need them) read ~/.profile, and not copy-paste env variables into their .rc files :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question