File: //scripts.20110531.215904.25158/usersscpcmd1
#!/usr/bin/expect --
set host [lindex $argv 0]
set user [lindex $argv 1]
set file [lindex $argv 2]
set dest [lindex $argv 3]
set pass [read stdin]
if {$host == ""} {
puts "You must set a host"
exit
}
if {$user == ""} {
puts "You must set a user"
exit
}
if {$dest == ""} {
puts "You must set a dest"
exit
}
if {$file == ""} {
puts "You must set a file"
exit
}
if {$pass == ""} {
puts "You must set a cmd"
exit
}
spawn scp -o "Protocol 1" -o "StrictHostKeyChecking no" $file $user@$host:$dest
expect "*assword:" {
sleep 1;
send "$pass\r"
}
expect -timeout 7200 "100:"