how to replace path
I added a path in my bash_profile so that I could use the executables in the directory (I thought). But it turned out some other directory has the same executables and the path had already been added by the previous user. Is there way to overwrite this path? I can't find where that old path was added. Thanks
|
review your .basrh file, you may have a line like:
# enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi If so review the file /etc/bash_completion. Jose Valdivia Blog: http://soad1982.blogspot.com |
Post your $HOME/.bash_profile and /etc/profile
|
You could simply add your path to the beginning instead of the end.
If you know which path was is causing the problem, you could use sed to replace it at the end of your PATH= statement. Or you could delete it from PATH, and add it to the end in the right hand side of your assignment. example moving ':/usr/games' to the end of the PATH variable. PATH="${PATH/\/usr\/games:/}:/usr/games" |
Quote:
|
Quote:
|
Code:
echo $PATH |
There may be an /etc/profile.d/ directory which contains scripts that are sourced by profile when you login. Sometimes there is also an /etc/profile.local file that is sourced and intended for your own system changes. Your distro my want /etc/profile left alone in case changes need to be made, or it sources functions that the system uses, or just to prevent you from removing the lines that source the /etc/profile.d scripts.
|
Quote:
|
(1) which <program name> will tell you which (from where in the PATH variable), the <program name> is picked up for execution.
(2) To be sure add it in your .bash_profile (the final one to be executed and which is tailored for your environment) thus Code:
PATH=<myPath>;$PATH End |
Quote:
|
All times are GMT -5. The time now is 05:30 PM. |