summaryrefslogtreecommitdiffstats
path: root/scripts/automation/sshpass.exp
blob: f27210c8c20f9bda4532eedeabeccd7102c83317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/cisco/bin/expect -f
#  ./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 $name@$server  $cmd_str
match_max 100000
expect "*?assword:*"
send -- "$pass\r"
send -- "\r"
interact