ssh_cmd.exp 263 B

1234567891011121314
  1. #!/usr/bin/expect -f
  2. set timeout -1
  3. set host [lindex $argv 0]
  4. set password [lindex $argv 1]
  5. set cmd [lindex $argv 2]
  6. spawn ssh -o StrictHostKeyChecking=no root@$host $cmd
  7. expect {
  8. "password:" {
  9. send "$password\r"
  10. exp_continue
  11. }
  12. eof
  13. }