I'm assuming you meant
export PATH=$PATH:./
and you are correct, that would put the native commands first and only
once nothing was found there would it try my foo file in my current
directory. Would this work without the trailing slash? I've never tried it.
I guess I wasn't all that concerned about malicious scripts living in my
home directory with the same name as a real command. So somebody somehow
puts a script called "ls" in my home directory in the hopes that I may
have modified my path to put ./ first seems a bit of a stretch. At least
if they could drop a script file they could probably also drop a new
.profile to alias ls to their bad script located somewhere else less
noticeable.
CB
On 7/7/11 4:42 PM, Geoff Shang wrote:
On Wed, 6 Jul 2011, Chris Blouch wrote:
export PATH=./:$PATH
That adds the ./ location plus all the existing path settings. Now
you should be able to just run foo from wherever you are without
putting the ./ in front.
This is not recommended, however. All you need is some nasty script
or whatever to plonk something in your working directory that has the
same name as a standard system program (e.g. ls) and you could find
yourself running their nasty program instead of the program you meant
to run.
Of course, if you used:
echo PATH=$PATH:.
instead, at least it would search in the standard search path before
finding your local binary. But personally I prefer just to type "./"
before whatever it is I want to run. At least I'm meaning to run the
program.
Geoff.
--
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/macvisionaries?hl=en.