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:
set mypassword [lindex $argv 0]
spawn ssh firstname.lastname@example.org
expect "password: "
If you want to pass additional arguments, they would be accessible using additional lines:
set arg2 [lindex $argv 1]
set arg3 [lindex $argv 2]
and so on.