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

Re: permanently add dir to $PATH



Am 16. Sep, 2016 schwätzte Tony Baldwin so:

moin moin Tony,

as mentioned, I'm working with a new Jessie installation and having a coupl headaches, the first had to do with getting a kernel module to load on boot (already wrote to the list about it.)

The other problem is trying to permanently add $HOME/bin to the $PATH.

I have in .bash_profile
PATH=$PATH:$HOME/bin
export PATH

But every time I boot I have to manually add it again.

You have to add it to the file again?

/etc/skel/.profile includes $HOME/bin

$ tail -4 /etc/skel/.profile # set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
$

But, the top of the file lets us know it's not used if ~/.bash_profile
exists.

The bash manpage lists the purpose of ~/.bash_profile and ~/.bashrc.

       ~/.bash_profile
              The personal initialization file, executed for login shells
       ~/.bashrc
              The individual per-interactive-shell startup file

~/.bashrc gets read for all shells, including screen and tmux instances
and GUI logins that don't invoke login shells, so I put my changes
in ~/.bashrc rather than ~/.bash_profile. If I had interactive
configurations, then I would put those in ~/.bash_profile, everything else
goes in ~/.bashrc.

Actually, I put them in ~/.bashrc_local and include that from ~/.bashrc
so it's easier to keep my localizations synced across systems.

if [ -f ~/.bashrc_local ]; then
        . ~/.bashrc_local
fi

ciao,

der.hans
--
#  http://www.LuftHans.com/        http://www.PhxLinux.org/
#  "The world is a dangerous place to live, not because of the people who
#  are evil, but because of the people who don't do anything about it."
#    --Albert Einstein

Reply to: