tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ syntax question

c-shell ▻

Two easy scripting questions

In article <88a185$ijh$1@news-int.gatech.edu>,
Jehsom <jehsom@-NOSPAM-resnet.gatech.edu> wrote:
>Question 1: How can I wait for input for N seconds, then default to
>something if nothing is read?

Are you sure this is what you want to do?  It's a very poor choice of
user interface.

If the user's answer is so unimportant that you can take a default
value when they're not quick enough, perhaps you don't need to ask the
question at all.

If the answer is important, then you should wait as long as it takes.
Maybe the user's phone rang just as you asked the question.

There are a few occasions where it is reasonable to use this style of
user interface.  Recent RedHat releases run a program called `kudzu'
very early in the boot process, which may need to interact with
the user.  Because it's important that the boot process completes
unattended, there is a timeout, and a default action of "do nothing".
However, I still roundly curse `kudzu' whenever it times out on me.

Not much else in Unix acts like this, thank goodness.

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Two easy scripting questions
Date: 15 Feb 2000 13:23:04 -0000
Message-ID: <88bk0e$ead$1@ltpcg.star.le.ac.uk>
References: <88a185$ijh$1@news-int.gatech.edu>

△ comp.unix.shell △

◅ syntax question

c-shell ▻