how do i source .bashrc remotely
I'm currently writing a script to set some PATH in a remote machine using ssh. I have successfully set the variables in the .bashrc. However, it the last s开发者_如何学运维tep of my script is "source .bashrc". However, when i ssh to the machine manually, the PATH is still not set. What is the problem?
If on computer A, you set PATH
with a script run via ssh
on computer B, in a script, and then log in to computer B again, PATH
will go back to what it was initially. The computer doesn't remember the value of PATH
between processes, and it doesn't share it. PATH
is an environment variable which is specific to each process. If you use
export PATH
then it will be inherited by child processes, but here your second login session is not a child process of the first one.
精彩评论