Why "-bash: ifconfig : command not found" when typing "$ifconfig"
i typed "$ifconfig" in the redhat 4. And it returned above error.other users, it does not matter at all. So someone can tell me the reason.
thanks! |
Run as root, the command is "ifconfig"
|
Any reason else?
|
Because ifconfig is locate in /sbin
sbin is not in the path from regular users, only in path from root. you can execute the command by typing /sbin/ifconfig |
Well, this happens only if you have a variable ifconfig whose value is ifconfig and you're not root, that is
Code:
$ ifconfig=ifconfig Actually, you can run the ifconfig command as a regular user if you launch it with its absolute path: Code:
$ /sbin/ifconfig |
Thank everybody
I understood more about this issue!
thanks! |
Quote:
|
Quote:
in fact, it won't work, since export is a bash builtin command |
Quote:
add this line in ~/bashrc file export PATH=$PATH:/sbin |
~/.bashrc
but better to have it in ~/.profile that way it is also available to other shells ( ksh, ash , csh and so on ) |
All times are GMT -5. The time now is 05:52 PM. |