[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why debian put ~/bin beginning of $PATH



On 2017-08-09 03:11:48 +0800, spp mg wrote:
> In the ~/.profile has below default setting:
> 
> --------------
> # set PATH so it includes user's private bin if it exists
> if [ -d "$HOME/bin" ] ; then
>     PATH="$HOME/bin:$PATH"
> fi
> --------------
> 
> Why put ~/bin beginning ? Is that dangerous ?

No, it's the opposite that is potentially dangerous. For instance,
you install some executable foo in your ~/bin, so that you can run
just "foo". Then, imagine that after some system upgrade or package
installation, a new executable "foo" gets installed somewhere in
the system path. So, when you run "foo", it will no longer be your
executable, but the system one, and if this executable is destructive,
you may lose data...

It is "." that must never be put in front of the path. Putting it
at the end might be OK, but this is not even recommended, due to
the above issue and also because you may run a wrong executable by
mistake.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: