Reputation: 2208
I want to automate the run of the ./configure
command. When I normally run it, every time I have to press enter. I want to run this command from a shell script and I don't want it to wait for a user to press enter at each prompt for path. How do I achieve this ? I am using Ubuntu machine with bash shell. Thanks.
mdt-inference@ubuntu:~/MDT/mdst-libreoffice$ ./configure
Path to Office installation? [/usr/lib/libreoffice]
Path to Office SDK installation? [/usr/lib/libreoffice/sdk]
Note : I tried the below link but it does not work. How to simulate two consecutive ENTER key presses for a command in a bash script?
I have used "yes" command already but when I run ./configure there are multiple prompts which are more than two. When I use "yes"
, it just supplies argument to the first prompt only
Upvotes: 1
Views: 15132
Reputation: 3656
You might check out the cram Python package:
https://pypi.python.org/pypi/cram
It's designed for straightforward automation of command-line apps, and I've been pleasantly surprised by how well it's worked for my needs so far.
Upvotes: 0
Reputation: 641
yes
command can be used here (with just 2 enter key)
yes " " | head -2 | ./configure
In general, this should work.
yes | ./configure
Upvotes: 1