reading lines in C shell

byrne%TARTAN at CMU-CS-C.ARPA byrne%TARTAN at CMU-CS-C.ARPA
Thu Jan 5 03:55:32 AEST 1984


From:  Steve <byrne%TARTAN at CMU-CS-C.ARPA>

Assume you have a CSH file called readlines:

	#
	while (1)
		set x = "$<"
		echo $x
	end

then if you invoke readlines thus:

	readlines <readlines 		(or some other file to read)

it will read the lines one at a time.  I don't have a nice, clean
termination condition, but checking for variable 'x' having a zero
length string as it's value might work ok.  Also, if you change the "set x"
line to

	set x = `glob $<`

you get x as a vector of "words", and you can check this vector for
having length 0 as a loop termination condition.

steve
-------



More information about the Comp.unix mailing list