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

Marko Rauhamaa marko at pacujo.net
Sat Feb 4 17:53:35 EST 2017


Dan Sommers <dan at tombstonezero.net>:

> On Sat, 04 Feb 2017 21:19:06 +0200, Marko Rauhamaa wrote:
>> Now, that's why the distros are careful to place $HOME/bin as the
>> final entry of PATH; the system commands take precedence over the
>> user's personal ones. However, the user is free to define the PATH
>> any way they like.
>
> I deliberately put $HOME/bin at the beginning of my path so that I can
> override system commands.

You have been warned.

>> There's a school of thought that a script should never rely on PATH
>> but it should spell out the complete path of every command it
>> executes (including "mv", "cp", "rm" and the like) ...
>
> It's usually sufficient to reset PATH at the top of a system script,

But they don't. For example, /usr/bin/mkofm (whatever that does...):

========================================================================
#!/bin/sh
# Initial definition.  For the moment only makes .tfm files.
mktextfm "$@"
========================================================================


Marko



More information about the Python-list mailing list