summaryrefslogtreecommitdiffstats
path: root/scripts/automation/sshpass.exp
blob: 3b5ce56036f98254ced594f16fc4ac3a29e582b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/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"
expect eof
wait
#interact