$PATH question
If you have two scripts with the same name in different directories in $PATH, which one runs?
For example, I have /usr/bin/myscript.sh and /usr/local/bin/myscript.sh. Code:
user@linux>echo $PATH |
First is launched from "/usr/bin" because it is ealier in PATH variable than "/usr/local/bin". How to change depends on distribution. For example in Ubuntu you can edit PATH environment variable in file "/etc/environment" globally or in your home directory in ".profile" file for one user.
|
It reads from left to right. So it will consider the one that comes first. i.e. if your script is in /usr/bin and /bin both, then it will consider the one which is in /usr/bin.
|
FYI: An alias will be run before it looks in the PATH.
|
Quote:
Cheers! Nbiser |
All times are GMT -5. The time now is 02:19 AM. |