I am looking for a way to execute a local command when logging into a remote machine via SSH. (I want to stay logged in after the command has finished.) In other words, I want to specify the command on my command line. It should be executed on the remote machine and then I should get the shell, as if I had logged in normally.
For instance, let's say, I want to mount
/home on the remote machine before I get the shell. I would do something like this (which does not work well)
ssh mymachine.example.com 'mount /home ; /bin/bash'
In effect, I am looking for a way how to condense the following two commands into one:
ssh mymachine.example.com 'mount /home' ssh mymachine.example.com
Does anybody have any idea how to do it?
IMPORTANT: I don't want to store the command-to-be-executed on the remote machine. It must be stored locally (perhaps it contains my password to de-crypt the encrypted home.)