This question reminded me of one of my own. I want to create an alias that will ssh
to a machine, runs a command (in this case, cd
to a provided path) and then gives me a shell. I've run a hundred variations of this:
$ ssh user@machine 'cd /some/path/ && bash -i -l'
which is about the best I can do. It gives me a bash prompt in the right directory, but without job control and without the ability to use arrow keys (and some other shortcuts). Is there an easy way to do this?
I can't do this easily at the end of my bashrc or profile, because the path I want to go to will vary (I'll pass it as an argument to the alias) and occasionally, I'll even ssh to that machine without wanting to go anywhere weird at all -- home directory is fine.