Say I have the following Bash script stored in the file foo.sh:
foo.sh
#!/bin/bash echo foo
Without having to scp the fi
scp
ssh root@MachineB 'bash -s' < local_script.sh
I got it from that thread: How to use SSH to run a shell script on a remote machine?