According to the bash invocation sequence, if a non-interactive, non-login bash shell is invoked via ssh, it's supposed to source ~/.bashrc. This works just fine with the OS X-shipped Bash 3.2.48(1)-release.

However, when I install bash 4.2.8(2)-release and set that as my login shell, executing a command via ssh (e.g. ssh <host> <command>) doesn't source my ~/.bashrc.

Does anybody know what's wrong, or how I can work around this?

link|improve this question
feedback

1 Answer

You can run bash through ssh with the --login option. Like so:

ssh <host> bash --login -c "command"
link|improve this answer
Not applicable in my case. SSH is being run by another utility (specifically, git). I have no control over its invocation. – Kevin Ballard Apr 17 '11 at 3:35
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.