On Fri, Jun 24, 2022 at 9:09 AM Anil F Duggirala <anilduggirala@fastmail.fm> wrote:
hello,
I would like to change the $PATH environment variable permanently, to
be able to execute a program more quickly.
I have tried adding a new line: export PATH=$PATH:/my/path , to my
.bashrc .
When I log in again, I see that $PATH is now: $PATH:/my/path/:/my/path,
my directory has been appended twice.
I don't know exactly what the "export" command actually does, so I am
lost here.

I expect many other command-line tools are also unknown to you.  Adjusting the
PATH setting may not be the best solution if you just want to run one program.
You can add your program to the GUI configuration to start it with an icon, put a
symbolic link to the program in a directory that is already in the PATH, such as
$HOME/bin, create a shell script that runs the program with additional environment
settings, and many more depending on how the program is used.

Once your linux usage moves beyond web browsing it is important to master some
basic command-line/shell tools.  There are many dangerously misleading youtube
tutorials (avoid those that claim to be easy or fast!) and a few that are excellent, but I
suggest starting with LinuxCommand.org as it has been used by many people for
years.

If the directory you want to add to the PATH contains a single program, other methods
are probably more appropriate.   The reason the PATH is added twice is that ~/.bashrc
gets run each time bash is invoked.   If you log in on a text console you normally see one
entry in the PATH.   If you are in a bash terminal session and see 2 entries, starting bash
again will give 3 entries.

On Fedora, /etc/profile defines a shell function called pathmunge that checks to see if
a directory is already in the PATH before adding it to the PATH. 


 
thanks for your help.
--
George N. White III