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

Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell



Roberto C. Sánchez (12020-07-07):
> You should add the export command to ~/.bashrc (for it to only be in
> effect for that user)

Except ~/.bashrc is only sourced for interactive shells, it will not be
run when applications are executed by a GUI, for example.

(Also, for some reason, the bash authors thought it was a good idea to
have login interactive shells not run ~/.bashrc; better use a saner
shell and put the environment in ~/.zshenv, which is sourced by all
shells.)

But adding the application bin directory to the $PATH environment is
entirely the wrong way of going at it. It results in huge $PATH, which
increase the cost of running everything and makes the system more
fragile. The right way of going at it is to make the application entry
points appear in the directories that are already in $PATH.

cd ~/bin
ln -s ../opt/something/bin/something

(relative paths are to be preferred in these cases)

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: PGP signature


Reply to: