#!/usr/bin/expect set host "192.168.31.100" set password "lishiming" spawn ssh [email protected]$host expect { "yes/no" { send "yes\r"; exp_continue } "assword:" { send "$password\r" } } expect "]*" send "touch /tmp/1.txt\r" expect "]*" send "echo 1212 > /tmp/1.txt\r" expect "]*" send "exit\r"
时间: 2024-10-24 05:00:03