shell脚本的自动交互

使用expect来自动应答shell的交互

#!/usr/bin/expect
spawn openssl req -new -key server.key -out server1.csr
expect "Country Name"
send "\n"
expect "State or Province Name"
send "\n"
interact