Command Preference

Kevin J. Cummings cummings at kjchome.homeip.net
Fri Jul 9 02:41:29 UTC 2010


On 07/08/2010 10:15 PM, Alejandro Rodriguez Luna wrote:
> 
> Hi all!!, i have a question related to the preference of a command.
> 
> What if I have 2 command like ls, one in /bin/ls and another in
> ~/bin/ls, i'd like to use my own ls, how i can do that?
> 
> putting PATH=~/bin:/bin. I mean, my path at the beginning?

Setting your PATH environment variable is the preferred way to specify
command execution preferences.  The directories listed there get
"searched" in order looking for the command to run.  IIRC, shell builtin
commands get run before checking the PATH.

Don't forget to "export" your PATH variable during or after setting it
so that sub-shells can use the new value.

And don't forget to look at what your system is currently using for a
PATH as you don't want to break it with your changes....

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the users mailing list