How can csh detect EOF on stdin?

Mike Khaw mkhaw at teknowledge-vaxc.ARPA
Fri Jun 10 07:06:13 AEST 1988


What's the csh equivalent of the /bin/sh:

	while :
	do
		read INPUT_LINE
		if test $? -ne 0; then break; fi	# EOF, exit loop

		# not EOF, process the line ...
	done

After "set input_line = $<", $status is always 0.  My system doesn't have
the line(1) program, so that's not an acceptable alternative.  Also note
that the input may contain blank (zero length) lines, so testing $input_line
== '' doesn't work right.

Thanks,
Mike Khaw
-- 
internet: mkhaw at teknowledge.arpa
uucp:	  {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
hardcopy: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303



More information about the Comp.unix.questions mailing list