Trying to answer this without saying which solution is "best", but only to provide an explanation as to why Gilles might suggest using symbolic links for providing a set of tools, and addressing the maintainence aspect of that. In the end, it is the local administrator that decides what the appropriate solution on their system might be.
By adding the bin
directories to users' PATH
, adding a new tool would require an update to all user's PATH
variable (which would not be in effect until a new shell session was started).
Using GNU stow
, as Gilles suggest, you would have a directory structure under e.g. /opt/stow
with one directory for each tool, each with its own bin
, lib
etc. subdirectory. Each tool would typically have been installed by specifying /opt/stow/toolname
as the installation prefix.
The subdirectories would be symbolically linked to the corresponding directories under /opt
by stow
, so the maintenance cost is minimal. The only directories that you would have to add to PATH
would be /opt/bin
and possibly /opt/sbin
.
Typically, you would have
/opt/stow/tool-A-1.23
/opt/stow/tool-A-1.25
/opt/stow/tool-B-3.0
Then:
cd /opt/stow
stow tool-A-1.23
stow tool-B-3.0
This would populate the /opt
hierarchy with the appropriate symbolic links, allowing you to access the executables for both tools in /opt/bin
. This is assuming there are no name clashes in the executables between the tools, but then again, you'd have the same issue when adding all those paths to PATH
.
To switch from 1.23 to 1.25 of tool-A
,
cd /opt/stow
stow -D tool-A-1.23
stow tool-A-1.25
There is never a need to manually maintain symbolic links or to change users' PATH
, and the change would be immediate for all users.
/opt/bin
and put that in my PATH. Then add symlinks to it. It reduces the search path of PATH. It also means that you don't have to update the PATH of all users, and when a new link is added, it will work immediately. – ctrl-alt-delor Jul 01 '18 at 10:57