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