I'm looking to, all in the course of one batch file:
- ssh into a remote computer
- execute commands (per the batch file) on the remote host.
What options do I need to add to the ssh invocation so that the batch file executes the lines following the ssh invocation over the connection?
e.g., with sftp it's simply adding a -b /dev/stdin and then << EOF at the end; how do I do this with SSH?
Best Answer
You can just run
to run all commands in
batch_file.sh
onmachine_name
. Works with at least OpenSSH. If you want to enter those commands by yourself before openingssh
, you can use