what's the use of "{ list }" in /bin/sh?

Lawrence V. Cipriani lvc at tut.cis.ohio-state.edu
Thu Jul 7 10:34:35 AEST 1988


In article <12334 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> In article <3305 at palo-alto.DEC.COM> vixie at palo-alto.DEC.COM (Paul Vixie)
	...
> Actually, it has one more use:
> 
> 	while { setup; test } do ...
> 
> or any other place where a compound statement is needed and only
> a single statement is allowed.  (while and until are about it!)

You could write:

	while	command1
		command2
		...
		commandn
	do
		...
	done

This works in the BSD /bin/sh.  I guess this syntax must have been
there all along.

This is an obscure corner of sh/ksh syntax; I was not aware of it
until I reviewed the ksh book by Korn and Bolsky.

> In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)

-- 
Larry Cipriani, AT&T Network Systems and Ohio State University
Domain: lvc at tut.cis.ohio-state.edu
Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (strange but true)



More information about the Comp.unix.questions mailing list