#!/bin/bash ### 執行遠程 操作 ssh root@192.168.243.129 > /dev/null 2>&1 << remotessh cd /usr/local/test touch remote.txt exit remotessh
在128服務器上執行 如上 腳本,將會在239服務器 /usr/local/test 目錄下新建 remote.txt 文件。
<< remotessh ... remotessh 這個是一對標識符,自己可以隨便命令但是要保持名稱一致。
exit :代表退出遠程節點。