4

I have a program .path.py which prints an export command for PATH. In my .bashrc I have an entry at the top $(python $HOME/.prefix/.path.py) except that when I login over ssh, or even run source $HOME/.bashrc those paths are not exported. Manually running $(python $HOME/.prefix/.path.py) works fine though. On other linux systems I've used this method normally works fine, it's just on my Ubuntu 14.04 desktop that it isn't.

Can anyone help me fix this? Comment with any additional information which would be helpful. Please note there are no newlines in this text, only spaces.

export PATH=/home/username/.prefix/calc/bin:/home/username/.prefix/misc/bin:/home/username/.prefix/testu01/bin:/home/username/.prefix/calc/bin:/home/username/.prefix/misc/bin:/home/username/.prefix/testu01/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/intel/bin/ CPLUS_INCLUDE_PATH=/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include:/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include:/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include: LIBRARY_PATH=/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64:/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64:/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64: C_INCLUDE_PATH=/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include:/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include:/home/username/.prefix/calc/include:/home/username/.prefix/misc/include:/home/username/.prefix/testu01/include: LD_LIBRARY_PATH=/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64:/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64:/home/username/.prefix/calc/lib:/home/username/.prefix/calc/lib64:/home/username/.prefix/misc/lib:/home/username/.prefix/misc/lib64:/home/username/.prefix/testu01/lib:/home/username/.prefix/testu01/lib64:
3
  • Can you show the part of the .bashrc that uses that script and a sample output of that script?
    – Salem
    Sep 13, 2014 at 21:06
  • @Salem I've added some sample output. The .bashrc` script simply contains the line $(python $HOME/.prefix/.path.py)
    – chew socks
    Sep 13, 2014 at 21:14
  • 1
    BTW, you have a trialling colon at the end
    – Braiam
    Sep 13, 2014 at 21:29

2 Answers 2

5

~/.bashrc is only sourced for non-login shells, so it's not sourced when you log in using ssh.

Use .bash_profile instead.

Related: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

3
  • Oh...where should that script be then?
    – chew socks
    Sep 13, 2014 at 21:11
  • Added information to answer.
    – Jan
    Sep 13, 2014 at 21:14
  • Thanks. Should .bash_profile source Ubuntu's .profile since it has a comment saying if .bash_profile exists it won't be sourced?
    – chew socks
    Sep 13, 2014 at 21:15
0

On Ubuntu this method does in fact work. However, there is a line in the default .bashrc that sets PATH without the existing PATH. My script needed to be moved to the bottom of .bashrc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .