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

Jeff Rodriguez jjr at ut-emx.UUCP
Mon Jul 11 03:17:25 AEST 1988


leo at philmds.UUCP (Leo de Wit) writes:
>>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!)
>
>Actually, the while keyword is followed by a command-list (according to
>'An Introduction to the UNIX Shell' by S.R.Bourne, Appendix A - Grammar).
>
>So you CAN write:
>
>	while setup; test; do ...
>
>And, as I pointed out in an other posting, the '}' cannot be used as a
>command separator/terminator (while ')' can). So there should be a ; or
>newline after test.

Why doesn't it work on my machine?  Here's what I get:

Script started on Sun Jul 10 12:06:46 1988
% while { date; date } do date
while: Missing }.
% while date; date; do date
while: Expression syntax.
% 
script done on Sun Jul 10 12:07:17 1988

I'm using an Encore multiprocessor running 4.3 BSD UNIX.
On this machine, "man csh" tells me about the command

   while (expr)
   ...
   end

but I can't find any mention of a while-do command.

			Jeff Rodriguez
			jjr at emx.utexas.edu



More information about the Comp.unix.questions mailing list