Trick is add this around the path add.
If [ $path_add -ne 1 ] ; then
Path addition code
Path_add=1
Fi
That only runs it once.
This is a work around for using ,bashrc when .bash_profile is where this should be done.
I think that advice goes back to a time before modern GUI's. Now many users have never
encountered a terminal, and distros vary widely in the use of ~/.bashrc, ~/.bash_profle, and
~/.profile.
On my Fedora 35 box, ~/.bash_profile is:
----------------------------------ser
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
---------------------------
Some distros have complicated ~/.bashrc or `/.bash_profile files with a section devoted to
interactive sessions. This led to issues where users added settings in the wrong section.
I often ask users to run a failing command in a terminal where they may see messages
that their GUI tools hide, but getting different behaviours between GUI and terminal has
become a problem.
--