Reputation: 3
Using a batch file, I want to ssh into example@0000, and then I want to execute a command in the server "example@0000".
My code looks like this:
1: @echo off
2: ssh example@0000 #this line works fine
3: ssh example_child@0000 #this line can only execute once the previous ssh is terminated.
Before my bat executes, my command line would look like this:
C:/home/username:
After line 2 executes, cmd will look something like this:
example@0000_bash $:
I now want the batch file to push line 3 INTO the current "example@0000" session, like this:
example@0000_bash $: ssh example_child@0000
The end result should look like this:
example_child@0000_bash $:
Upvotes: 0
Views: 668
Reputation: 6842
Just inline your ssh command, the below will execute the second ssh on you example node.
ssh example@0000 ssh example_child@0000
Upvotes: 1