Quote:
Originally Posted by jprathap
My doubt is how to get the password as an argument . In this script. Is there way to get the argument like in shell ( $1).
|
The simplest way would be to change your script to:
Code:
#!/usr/bin/expect -f
set mypassword [lindex $argv 0]
spawn ssh user@192.168.2.3
expect "password: "
send "$mypassword\r"
interact
If you want to pass additional arguments, they would be accessible using additional lines:
Code:
set arg2 [lindex $argv 1]
set arg3 [lindex $argv 2]
and so on.
Good luck.
--
RT