[英]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.