Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to automate the installation of a program through a shell script. There are a few steps which require user interaction from the command line (confirmation, yes/no, etc.). What is the best way to by-pass it? I know that one possibility is to use an expect script. Just wanted to know if there is a better/cleaner way to do this.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

If the interaction is simple, i.e. only reads from the standard input, you can just send the particular lines to the program's input:

( echo yes ; echo 1024; echo yes ) | install.sh
share|improve this answer
add comment

If you want to do anything that doesn't just read from stdin (e.g. ftp login) you'll want to use expect.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.