I have two remote server and i am trying to execute more than one command on a remote host to which i am connected by using ssh command. My command syntax is like:
ssh -t -i key-1 user1@remote-1 "ssh -t -i key-2 user2@remote-2 "cmd-1;cmd-2;...cmd-n;"";
I have tried using semi-colon (;) and && symbols between two commands and observed that first command executes on remote-2 and second command executes on remote-1.
My requirement is that I want to execute all commands except the last one on remote-2. And, the last command on remote-1.
Note: I know how to execute multiple commands by connecting to single remote host. So, I will appreciate if answer is given only after understanding the problem statement.