shell脚本的自动交互

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

1
2
3
4
5
6
7
#!/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