best way to ensure './' is at beginning of sys.path?

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Sat Feb 4 12:49:56 EST 2017


Wildman writes:

> On Sat, 04 Feb 2017 11:27:01 +0200, Jussi Piitulainen wrote:
>
>> Wildman writes:
>> 
>> [snip]
>> 
>>> If anyone is interested the correct way is to add this to
>>> /etc/profile (at the bottom):
>>>
>>> PATH=$PATH:./
>>> export PATH
>> 
>> Out of interest, can you think of a corresponding way that a mere
>> user can remove the dot from their $PATH after some presumably
>> well-meaning system administrator has put it there?
>> 
>> Is there any simple shell command for it? One that works whether the
>> dot is at the start, in the middle, or at the end, and with or
>> without the slash, and whether it's there more than once or not at
>> all.
>> 
>> And I'd like it to be as short and simple as PATH="$PATH:.", please.
>
> No, I do not know.  You might try your question in
> a linux specific group.  Personally I don't understand
> the danger in having the dot in the path.  The './'
> only means the current directory.  DOS and Windows
> has searched the current directory since their
> beginning.  Is that also dangerous?

I'd just like to be able to decide for myself.

(Which I am, of course. In shell it's just more annoying to remove than
it is to add, as far as I know.)



More information about the Python-list mailing list