Prompting for yes/no in csh

Blair P. Houghton bhoughto at hopi.intel.com
Wed Jan 9 03:20:25 AEST 1991


In article <3821 at ns-mx.uiowa.edu> dkeber at umaxc.weeg.uiowa.edu (Dave Keber) writes:
>What is the easiest way to prompt for a yes/no (or any string/number, etc.)
>from a csh shell script?

	echo -n "continue? "
	set foo=$<

Salient points:
The -n leaves the cursor on the same line as the prompt; the
quotes allow a space after the prompt; $< reads the script's
standard input up to a newline; and, foo will contain everything
typed, including whitespace, but not the newline.

RTFM for csh(1) and echo(1).  You could have learned all of
this there.  It's the advice of everyone who's ever
answered (or asked) a question on the net that you exhaust
your resources before asking such questions.

				--Blair
				  "Resource your exhaust?"



More information about the Comp.unix.shell mailing list