Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/expect -- # A wrapper around scp that knows how to answer password prompts # 2004apr01 # (find-angg ".passwds.tcl") source $env(HOME)/.passwds.tcl proc hostunknownprompt {} { return "Are you sure you want to continue connecting (yes/no)?" } proc passwdprompt {whoatwhere} { return "$whoatwhere\047s password:" } proc sendpasswd {key} { global passwd; send "$passwd($key)\n" } # (find-expcommand "interact" "-nobuffer") # (find-expcommand "interact" "The -o flag") eval spawn scp $argv interact -o \ -nobuffer [passwdprompt edrx@sucuri.mat.puc-rio.br] {sendpasswd puc} \ -nobuffer [passwdprompt edrx@angg.twu.net] {sendpasswd twu} \ -nobuffer [passwdprompt edrx@parati] {sendpasswd parati} # -nobuffer "[hostunknownprompt]" {send "yes\n"} # A test: # (eev "cd /tmp/; Scp edrx@sucuri.mat.puc-rio.br:o .")