Re: Yes/No -> Si/No / ixnay / better input routine

From: Alfie Costa ([email protected])
Date: Sun Jun 24 2001 - 21:56:35 CEST


On 24 Jun 2001, at 10:49, [email protected] <[email protected]> wrote:

> ( Ja Si Oui Yes 1 --> y / Nein No Non No 0 --> n ) (y/n)?

Making things easier is worthwhile, but a complex prompt might terrify many
novices. If the principle was to speak to all in their own terms, why stop
with German Spanish French and English...

( Ja Si Oui Yes Ne Hai Ja Da Tak Jest Igen Po Evet Aiwa 1 --> y
Nein No Non No Okhee Iie Nee Nu Nie Ne Nem Jo Hayir Lah 0 --> n ) (y/n)?

...etc.

---
Changing the subject to making input more user-friendly in general, it may help 
to have a whole new input program.
Currently the scripts ask a question, assign it to a string, and then parse the 
answer.  They check if it's a good answer, and ask again if it isn't.
 
Better to prevent bad input.  Given a (y/n) prompt, if the user types 'j', the 
computer should just beep, or if there was no sound, the screen could make a 
face.  The script would accept only yYnN or <Enter>.  Some util like MsDos' 
'CHOICE' or BASIC's 'INKEY$' would be needed though.
Difficult pseudocode like this:
	:start
	SomeStringInputRoutine "Is it Yes or is it No?" $A
	if ucase(left(1,$A)) = "Y" goto end
	if ucase(left(1,$A)) = "N" goto end
	goto start
	:end
...becomes a one liner like this:
	A=`choice yn "Is it Yes or is it No?"`
...or maybe:
	choice yn "Is it Yes or is it No?" A
It all depends on how this hypothetical 'choice' util works of course.  I'm 
curious if anyone on the list knows of any existing Unix utils like 'choice'.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:19 CET