1 #!/usr/bin/expect -f
2
3 set timeout 1
4
5 set username [lindex $argv 0]
6 set password [lindex $argv 1]
7 set host_filename [lindex $argv 2]
8 set new_dir [lindex $argv 3]
9
10 eval spawn scp $username@$host_filename $new_dir
11
12 expect "password: $"
13 send "$password\n"
14
15 expect "$ $"
It is very useful application while supporting many hosts, nobody really wants to make the same thing for all the hundreds machines. Let your script do that.
No comments:
Post a Comment