Passing arguments to an expect script as variables
# cat test.sh #!/usr/bin/expect -f set username [lindex $argv 0] set password [lindex $argv 1] spawn ssh $username@HOST expect “password:” send “$password\r” …
# cat test.sh #!/usr/bin/expect -f set username [lindex $argv 0] set password [lindex $argv 1] spawn ssh $username@HOST expect “password:” send “$password\r” …
#!/usr/bin/expect -f spawn ssh root@bcmm.liho.tw expect “password:” send “PASSWORD\r” expect “system>” send “power -on -T system:blade\[1\]\r” expect “system>” send “power -on -T …