I'm writing a script that should set up a server with no user input. Whatsoever.

In order to automate installation of some programs, I used expect. However, what can I use to automate expect instalation?

During the instalation user is prompted

Do you want to continue? [Y/n]

and I want to automate the response (Y).

Any ideas?


The simplest approach is to use yes:

       yes - output a string repeatedly until killed

       yes [STRING]...
       yes OPTION

       Repeatedly output a line with all specified STRING(s), or 'y'.

In most cases, it is enough to run yes | command where command is whatever runs the installation.

  • 1
    "For more complex cases, you should check out expect." - You are a funny guy :D I'll check out yes command. – Karlovsky120 Sep 8 '14 at 23:30
  • 2
    @Karlovsky120 not funny, just tired. I saw you had tagged with expect but failed to read that you actually used it. I was even wondering why you had tagged it since you hadn't used it. D'oh! :) Anyway, yes should do until you get expect ready. It's part of coreutils so it should be installed by default on any GNU system. – terdon Sep 8 '14 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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