问题
In a bash script, I'm using wine to call a DOS program that requires me to "Press Enter to exit". How do I do that automatically and continue with the rest of the script?
回答1:
echo | wine dosprogram.exe
回答2:
You might be able to use the expect program.
Here is an example script:
spawn /path/to/program/Dynamips
expect -- "->"
send "start R1\r"
expect -- "->" {
sleep 5
send "start R2\r"
}
expect eof
You can invoke this with:
expect scriptname
回答3:
Send it the input 0x0D
来源:https://stackoverflow.com/questions/1349771/automatically-press-enter-to-exit-in-bash