我在文件sign.sh
中有此命令:
sudo openssl << EOF
engine dynamic ###long line here###
ca -engine pkcs11 ###long line here###
EOF
我在/usr/bin/expect
中使用了这个
#!/usr/bin/expect
set timeout 10
spawn "sign.sh"
expect "Enter PKCS#11 key PIN for SIGN key:" { send "pass_here\r" }
interact
这很有效。但是,我需要将spawn "sign.sh"
替换为spawn sudo openssl << EOF... etc
我如何让它工作?
答案 0 :(得分:1)
试试这样:
set script "
sudo openssl << EOF
engine dynamic ...
ca -engine pkcs11 ...
EOF
"
spawn bash -c $script