diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-06-24 14:03:29 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-06-24 14:03:29 +0300 |
commit | 8b52a31ed2c299b759f330c4f976b9c70f5765f4 (patch) | |
tree | 9d6da5438b5b56b1d2d57e6c13494b4e65d000e7 /scripts/automation/sshpass.exp |
first version
Diffstat (limited to 'scripts/automation/sshpass.exp')
-rwxr-xr-x | scripts/automation/sshpass.exp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/automation/sshpass.exp b/scripts/automation/sshpass.exp new file mode 100755 index 00000000..f27210c8 --- /dev/null +++ b/scripts/automation/sshpass.exp @@ -0,0 +1,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 |