假設本地的機器IP為10.245.111.90,我們想要在10.245.111.93上執行一個保存在10.245.111.90上的腳本。
經過測試通過的命令如下:
ssh root@10.245.111.93 'bash -s' < /root/testlocal.sh
如果要帶參數的話,那就需要參考這篇文章中描述的代碼了。
參考資料
=========
Execute Bash script stored in a file over SSH
https://stackoverflow.com/questions/5663679/execute-bash-script-stored-in-a-file-over-ssh