I have the following script:
#!/usr/bin/expectset timeout 20set cmd [lrange $argv 1 end]set password [lindex $argv 0]eval spawn $cmdwhile {1} { expect "id_rsa" send "$password\r";}interact
which intends to expect "id_rsa" and enter the password repeatedly while the spawned $cmd is open.
Now the script works but will always end with error
send: spawn id expx not open while executing ...
I want to write my code in a proper way such that the while loop is exited properly via check and not via error catching in expect so that the error will not show up.
Thanks in advance.