1

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

Community
  • 1
  • 1
Zack
  • 2,078
  • 10
  • 33
  • 58

2 Answers2

1

yes command can be used here (with just 2 enter key)

yes " " | head -2 | ./configure  

In general, this should work.

yes | ./configure
whoan
  • 8,143
  • 4
  • 39
  • 48
balabhi
  • 641
  • 5
  • 5
  • I tried this 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 – Zack Nov 09 '15 at 01:02
  • Try with yes " " | ./configure – balabhi Nov 09 '15 at 06:19
0

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.

Bill Agee
  • 3,606
  • 20
  • 17