Linux Shell expect 自动切换用户,自动输入密码,执行命令

1 #!/usr/bin/expect -f 2 3 set timeout 30 4 spawn ssh -l root 172.21.11.160 5 expect “password:” 6 send “1qaz@WSX\r” 7 8 9 expect “#” 10 send “cd /home/ls\r” 11 send “sh test.sh\r” 12 expect “*” 13 14
相关文章
相关标签/搜索