6 ms·
~/.profile is executed only at login on Ubuntu so changing your PATH there will be applied the next time you login. You can source the ~/.profile in your curren
by dghubble 13y ago
~/.profile is executed only at login on Ubuntu so changing your PATH there will be applied the next time you login. You can source the ~/.profile in your current non-login shell if you need the PATH change right now. I've tried to tweak the second paragraph in the "When not to modify .bashrc?" section to make this more clear.
Thanks for bringing this up.
- eslaught 13y agoThe problem is that running an MPI program on a remote node starts a new non-interactive SSH session. That SSH session has no parent login session, so it won't inherit environment variables from any session that read the .profile file. And because the SSH login is non-interactive, the only file that the shell inside the SSH session reads is .bashrc. Sure, you could source .profile manually, but this is awkward to code inside an MPI application. In addition, this will cause .bashrc to get sourced twice, because your shell already read .bashrc when it started the SSH session. Hopefully your .bashrc is idempotent, but even so, it feels wrong to have to read .bashrc twice. Try this on a remote server: remote:~$ cat .profile echo "read .profile" echo "sourcing .bashrc from .profile" source ~/.bashrc remote:~$ cat .bashrc echo "read .bashrc" And then from your local machine: local:~$ ssh remote read .profile sourcing .bashrc from .profile read .bashrc local:~$ ssh remote -k true read .bashrc