假设本地的机器IP为10.245.111.90,咱们想要在10.245.111.93上执行一个保存在10.245.111.90上的脚本。bash
通过测试经过的命令以下:ssh
ssh root@10.245.111.93 'bash -s' < /root/testlocal.sh测试
若是要带参数的话,那就须要参考这篇文章中描述的代码了。ip
参考资料rem
=========get
Execute Bash script stored in a file over SSHit
https://stackoverflow.com/questions/5663679/execute-bash-script-stored-in-a-file-over-sshio