0

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

4

1 回答 1

0

尝试${Array[pos++]}每次都会后增量。

于 2013-06-06T21:00:57.447 回答