[英]bash script Incremement array index inside expect code
这是我嵌入在某些bash脚本中的代码。
VAR=$(expect -c 'expect {
"name:" { send "'${Array[pos]}'"\r" ; exp_continue}
"hello" {send "hello\r" ; exp_continue}
}
但是,传递的必需值是存储在数组Array中的字符串。 如果输入错误,它将继续询问“ name:”,正确的值始终在Array中。 我如何每次都能提高排名,以便最终找到正确的条目?
谢谢
尝试${Array[pos++]}
,该值每次都会递增。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.