-1
私はExpectに関しては初心者ですが、ローカルマシンで最初に試してみると、足が濡れると思っていました。Linux用のExpectスクリプトの作成 "adduser"コマンド
私は、「adduser」コマンドに対してExpectを実行しようと考えていました。
すべて正常に動作しているようですが、最後のプロンプトに戻ることができて終了しますが、ユーザーは未作成のままです。
私は間違っていますか?
#/usr/bin/expect -f
spawn adduser testuser
expect "Enter new UNIX password"
send "testpassword\r"
expect "Retype new UNIX password"
send "testpassword\r"
expect " Full Name []: "
send "\r"
expect " Room Number []: "
send "\r"
expect " Work Phone []: "
send "\r"
expect " Home Phone []: "
send "\r"
expect " Other []: "
send "\r"
expect "Is the information correct? \[Y/n\] "
send "\r"
最後に 'expect eof'を追加します。 – Dinesh
'expect -d scriptname'でスクリプトを実行し、デバッグ出力を注意深く読んでください:パターンはすべて一致していますか? –