1

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?

1 Answer 1

3

The simplest approach is to use yes:

NAME
       yes - output a string repeatedly until killed

SYNOPSIS
       yes [STRING]...
       yes OPTION

DESCRIPTION
       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.

2
  • 1
    "For more complex cases, you should check out expect." - You are a funny guy :D I'll check out yes command. Commented Sep 8, 2014 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
    Commented Sep 8, 2014 at 23:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .