首先配置username和host地址,执行下列命令
spawn ssh ${username}@${host}
expect {
"yes/no" { send "yes\r"; exp_continue }
"password:" { send "${password}\r" }
}
expect "100%"
send "touch /home/qappsom/hello.txt \r"
expect "eof"
首先配置username和host地址,执行下列命令
spawn ssh ${username}@${host}
expect {
"yes/no" { send "yes\r"; exp_continue }
"password:" { send "${password}\r" }
}
expect "100%"
send "touch /home/qappsom/hello.txt \r"
expect "eof"