blob: 2262290f20d9edafa624db519468566911c24104 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/cisco/bin/expect -f
# sample command: ./ssh.exp password 192.168.1.11 id *
set pass [lrange $argv 0 0]
set server [lrange $argv 1 1]
set name [lrange $argv 2 2]
set cmd [lrange $argv 3 10]
set cmd_str [join $cmd]
spawn ssh -t $name@$server $cmd_str
match_max 100000
expect "*?assword:*"
send -- "$pass\r"
send -- "\r"
expect eof
wait
#interact
|