Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #!/usr/bin/expect
  2.  
  3. set host [lindex $argv 0]
  4. set password [lindex $argv 1]
  5.  
  6. spawn ssh $host
  7. ## expect_after eof { exit 0 }
  8.  
  9. expect "yes/no" { send "yes\r" }
  10. expect "password:" { send "$password\r" }
  11.  
  12. expect "#"
  13. send "echo \"hello\" > test.txt"
  14.  
  15. send "exit\r"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement