Bug Hunter Extraordinaire
Join Date: May 2005
Last Activity: 15 July 2019, 10:25 AM EDT
Location: In the leftmost byte of /dev/kmem
Thanks Given: 143
Thanked 2,179 Times in 1,532 Posts
and shell functions. Your PATH statement just modifies this value:
means: set the variable PATH ("PATH=") to what it contains now ("$PATH"), plus a colon (":") and a fixed string ("/usr/bin/gatk-18.104.22.168").
Again, you can do that on the command line (like you did), but this will be lost when you log out. The file ~/.bashrc now contains such collected command line settings and it is executed every time you log in. That means, to make the change last you will have to modify this file, like you did:
That simply adds (">>") the string export PATH=$PATH:"/usr/bin/gatk-22.214.171.124" to the end of the file ~/.bashrc - well, not quite, actually. Notice, though, that the content of "$PATH" will replace the string "$PATH" when you execute that and if, for instance, your PATH contained before the string:
then what you wrote into the file ~/.bashrc will be NOT the line
but in fact:
and this may or may not (most probably may not) be what you wanted. Anyway, when you want to have this setting not only in your future sessions but also in the current one you indeed have to use source ~/.bashrc because at the time when the file was executed - your login - the change was not there.
Further, appending directories to the path naively has a problem: you don't want the directories to be there several times. Take yours, for example, the existing path is just to show the effect, your will probably be different:
You probably want to avoid that. This is why i set the PATH in my rc-scripts this way:
It is easy to add or remove a line with a single directory this way and it is easy to grasp immediately what is what. For not-so-obvious settings i use comments to remind me what it was for (so i can also easily find out if it can be removed again). Also notice that a variable is either exported or not. If it is there is no need to export it again, just because its value has changed.
You first try:
but when I do a sudo nano ~/.bashrc
I hope this helps.