私はこのような期待ファイルを持っています。私は、1,2,3または4の値を送信できるようにしたい期待ファイル内の変数
expect myfile.exp
を使用してスクリプトが期待したファイル内の変数の概念があります呼び出しますか?
expect -exact "> "
sleep .1
send -s -- "1\r"
expect -exact "> "
sleep .1
# This prompt can take values 1, 2, 3 or 4
send -s -- "1\r"
# I want to replace "1\r" above with one of the 4 possible values at runtime
expect -exact "> "
sleep .1
send -s -- "1\r"
'[lrange $ argv 0 0]'ではなく '[lindex $ argv 0]'などを使ってください。 –