0
1行を処理した後、whileループを抜けるの内側に走りました。期待スクリプトは、私のようなwhileループを持っている
#!/usr/bin/expect -f
## Set up variables to be passed in as command line arguments
#set username [lindex $argv 0];
#set password [lindex $argv 1];
lassign $argv username password
spawn telnet 192.168.100.101 106
expect "200 PWD Server ready"
send "USER user\r"
expect "300 please send the PASS"
send "PASS password\r"
expect "200 login OK, proceed"
## Use the line below for passwords that do not have to be enclosed with quotes
send "SETACCOUNTPASSWORD $username PASSWORD $password\r"
# Use the line below for a password that must be quoted ie one that contains a $ or a ! by escaping the double quotes
#send "SETACCOUNTPASSWORD $username PASSWORD \"$password\"\r"
expect "200 OK"
send "quit\r"
interact
expectスクリプトは、ファイル内の行数と同じ回数実行する必要があります。しかし、最初の行が処理された後に停止します。コマンドをエコーのようなものに変更すると、expectスクリプトの中の何かがかなり確信しています。
私はスクリプトをデバッグする場合、私はこれを参照してください。
+ doit=/pathtocommand
+ file=/pathtofile
+ read -r username password
+ /pathtofile 0100 01000100
spawn telnet 192.168.100.101 106
Trying 192.168.100.101...
Connected to 192.168.100.101.
Escape character is '^]'.
200 PWD Server ready
USER user
300 please send the PASS
PASS pass
200 login OK, proceed
SETACCOUNTPASSWORD 0100 PASSWORD 01000100
200 OK
quit
+ read -r username password
スクリプトをやり直すしようとしますが、単純に終了ようにそれは私には見えます。誰も助けることができますか?私はこの問題を解決するために慌てている。私はSSHでこれを前にしていますが問題はありません。そのtelnetものか何かがわからない場合。