Bash Run a Local Script & Command on Remote Server using SSH

Use ssh to run a local bash script on a remote computer.

Use the following syntax:

ssh user@host sh < myscript.sh
ssh user@host bash < myscript.sh

If using bash, include "#!/bin/bash" at the top of myscript.sh and be sure to call `bash' instead of `sh' or you may get commands not found.

Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment