This is my code that I have embedded in some bash script.
VAR=$(expect -c 'expect {
"name:" { send "'${Array[pos]}'"\r" ; exp_continue}
"hello" {send "hello\r" ; exp_continue}
}
However the required value passed is a string that is stored in the array Array. If it gets it wrong it will continue to ask for "name:", the correct value is always in Array. How can I incrememnt pos each time so that I will eventually hit the right entry?
Thanks