to update .bashrc, although that doesn't work either. Thank you .
though if I log out then login, it's fine.
so maybe, source ~/.bashrc after the command?
A few clarifications: you can change your environment (of which the PATH variable is a part) on the command line. Enter set or env at the command line to see what your current environment is. Basically, it is a set of declarations of variables in the form:
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-4.0.10.1").
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-4.0.10.1" 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:
Quote:
but when I do a sudo nano ~/.bashrc
probably didn't work because by "sudo" you changed the environment of user "root", not the environment of the account you use to run the application. So, it "worked" in a way, but not one you could make use of.
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Hi,
I am having some NFS directory consistency problems with the below setup on a local (192.) network:
1. Different permissions (chmod) for the same NFS dir are reflected on different clients.
2. (more serious) an NFS dir created on client1 cannot be accessed on client2; this applies to some... (10 Replies)
Hello everyone I am a newcomer to UNIX and I have hit a snag in something that would probably take experienced people about 30 seconds. Long story short I am trying to add a directory to my PATH and it is getting added but not working. I mean, the object of adding it to the path is so I can access... (2 Replies)
I'm trying to set the path permanently through a shell script. (/opt/quest/bin:/usr/bin/lab to /.profile.) I tired using echo option like below but it doesn't work. Please suggest me the right way to do so.
echo "PATH=$PATH:/opt/quest/bin:/usr/bin/lab" >> /.profile (6 Replies)
Guys,
I did a search on this but couldn't find any thing.
I need to add /home/scadm/scripts to the PATH. If I do the below it works for the session I'm in. If I close it and reopen it doesnt work.
PATH=$PATH\:/home/scadm/scripts ; export PATH
I also want this path added to all the... (3 Replies)
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
Hello,
I want to add a port in the firewall exception list so that my application can be accessed over network even if firewall is disabled. I am using iptables command to add exception.
The problem is, after setting the rule if I change the firewall setting i.e. on/off then it is overwriting... (1 Reply)
I have a machine with an interface that has two different addresses on CentOS 5
eth0: 10.20.21.77
eth0:1 141.218.1.221
If I issue this command I get the result I'm looking for.
/sbin/route add -net 141.218.1.0 netmask 255.255.255.0 gw 10.20.21.77
ip route show dev eth0
141.218.1.0/24... (1 Reply)