editing PATH in bash profile
Hi!
I have installed Fedora 9. When I try to run some command, like fdisk I get following error: Code:
[miroslav@localhost ~]$ fdisk and it looks lite this now: Code:
# .bash_profile Code:
sudo /sbin/fdisk |
what does
Code:
sudo -s note: sudo echo $PATH is not the same! |
Quote:
While not root: Code:
[miroslav@localhost ~]$ echo $PATH Code:
[miroslav@localhost ~]$ sudo -s Code:
[miroslav@localhost ~]$ su |
You cannot run fdisk without being root. Actually you can, but it does nothing nor spit any error message. I think it checks if your UID is 0 (root) otherwise exits.
|
Quote:
Code:
[miroslav@localhost ~]$ su |
You need to run "su -" to run as root with root's environment. What is wrong with "sudo /sbin/fdisk"?
Also, .profile or .bash_login are better places to edit your PATH variable. Every subshell you launch will add /usr to path again unless you test for it's presence before adding it. |
Quote:
Code:
[miroslav@localhost ~]$ su - but I wanted to explore other options. Quote:
|
If you don't have a ~/.profile or ~/.bash_login file you can create one yourself and put the same "export PATH=PATH:/usr" command there instead of in ~/.bashrc.
When you login, your .profile might source your .bash_rc file. When you open a new terminal, such as konsole, ~/.bashrc will be run again, and your PATH variable will end with ":/usr:/usr". Some PATH variables contain many more paths, for example adding directories for KDE, Gnome & Java. Having them repeated two or three times in PATH may waste some time searching in the same directories more than once. |
Quote:
|
would it search more than once? i thought when a file is searchd in $PATH it stops after the first match...
|
Y, but if it doesn't find it, it'll continue to search every dir in the PATH, each time it appears...!
|
All times are GMT -5. The time now is 06:06 AM. |