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
尝试${Array[pos++]}
,该值每次都会递增。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.