2

Every new instance of terminal forces me to export openmpi path before using it. I tried setting the path permanently using

echo export PATH="$PATH:/home/$USER/.openmpi/bin" >> /home/$USER/.bashrc


echo export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/">> home/$USER/.bashrc

However, this is not working. Please suggest a solution.

Thank you

muru
  • 197,895
  • 55
  • 485
  • 740
  • If you want to have exactly this string export PATH="$PATH:/home/$USER/.openmpi/bin" in ~/.bashrc you must put single quotes into the command: echo 'export PATH="$PATH:/home/$USER/.openmpi/bin"' >> /home/$USER/.bashrc. In other case variables will be substituted by their values. – pa4080 Jan 07 '17 at 11:58

1 Answers1

0
echo 'export PATH="$PATH:/home/$USER/.openmpi/bin"' | tee -a /home/$USER/.bashrc

and

echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/"' | tee -a /home/$USER/.bashrc
  • I have tried your solution plus http://askubuntu.com/questions/58814/how-do-i-add-environment-variables http://unix.stackexchange.com/questions/168340/where-is-ld-library-path-how-do-i-set-the-ld-library-path-env-variable Wonder what the problem is. Please comment. – Rupjit Chakraborty Jan 09 '17 at 06:47