Change PATH variable
I want to add my current working directory to the PATH variable and make it permanant in my .bash_profile so I can run my testscript without using the ./ charactors
can this be done? |
yes you can but it is not recommended, as it is a security risk, because if you are in some world-writable directory someone could plan a trojan program, say, ls. it is better to invoke programs in your current directory explicitly using ./
if you really wants to do it, here it is. export PATH=${PATH}:. |
That is only temporary of course.
To make it permanent as he wanted, he needs to add his directory to the PATH variable in /etc/bashrc or /etc/profile. Or he can add the code you gave him to his own hidden .bashrc file in his home directory. |
Thanks John
It is only for a linux class and I have put the wrong path in there and it wont let me do anything now. I am only a user so I can't get back in to change it back, so I have to wait till the administrator fixes it again. thanks JIm |
@ jimmydean
When you are able to log back into the system just remove the bad PATH you setup or better yet, put a hash mark # in front of the PATH statement. This will cause the shell to ignore that line. Then add a line like this to your .bashrc or .bash_profile file export PATH=$PATH:$HOME/bin In this example the bin folder is where all your scripts are located. You can replace bin with any directory of your choice. |
All times are GMT -5. The time now is 10:51 PM. |