2006-10-28

Anyone know how to get SSH/BASH to use your login environment for remote commands?

I am reworking my Mercurial/bazaar comparison so that I have a replay script that does everything. That way I can easily look at performance numbers, disk usage, etc. I am also adding in server usage.

But SSH is giving me issues at the moment for Mercurial. There is support to use SSH for executing remote commands, but my server is complaining it can't find Hg when executing commands through Hg:

Driftys-Computer> ssh drbrett hg version
bash: hg: command not found

Now SSH is working:

Driftys-Computer>ssh drbrett ls -l
total 12
drwxr-xr-x 5 brett users 4096 2006-10-27 23:15 data
drwxr-xr-x 7 brett users 4096 2006-09-11 13:26 installed
drwxr-xr-x 7 brett users 4096 2006-10-27 23:12 src

And Hg can be found when I have a remote shell through SSH:

Driftys-Computer>ssh drbrett
...
brett@bcannon:~$ hg version
Mercurial Distributed SCM (version 0.9.1)

But it seems that my .profile file for BASH is not being used:

brett@bcannon:~$ echo $PYTHONPATH
/home/brett/installed/lib/python2.4/site-packages:/home/brett/data/django:/home/brett/src/django-svn
brett@bcannon:~$ exit
logout
Connection to 66.35.62.34 closed.
Driftys-Computer>ssh drbrett echo \$PYTHONPATH
# Only a newline is printed.

Does anyone know how to make remote commands through SSH execute with the same environment you would have if you used a remote shell? I can't finish the Mercurial part of my review (and thus move on to bazaar) until I get this working since I want to be able to have a shell script that executes every step of the test commands. If you have any ideas as how to fix this please add a comment to this post.