Nested ssh startup commands on 2nd server
I can only get hostB from hostA and I want to run commands on hostB.
ssh -t $hostA ssh -t $hostB "
echo 'Hello World!'
echo 'Test!'
"
At the moment it will connect to hostA, then hostB and the script will be paused. As soon as I type exit (from hostB), I go back to hostA, 2 echo commands are printed and then automatically exit hostA.
How can I run commands on hostB?
+3
source to share