[comp.std.unix] { and } with for in /bin/sh

std-unix@longway.TIC.COM (Moderator, John S. Quarterman) (04/06/90)

From: Maarten Litmaath <uunet!cs.vu.nl!maart>

In article <528@ehviea.ine.philips.nl>,
	leo@ehviea.ine.philips.nl (Leo de Wit) writes:
)...
)The fact that the terminating } has to be preceded by a command
)separator as opposed to the terminating ) where it is not needed, seems
)rather odd to me.  This also goes for the start {, that has to be
)followed by white space to be considered a token, as opposed to the
)start (. Was { } perhaps a 'last minute hack' ?

Whatever, it has the advantage of making the following possible:

	$ echo {1,2,3}{a,b,c}
	1a 1b 1c 2a 2b 2c 3a 3b 3c

In csh this works as demonstrated, in ksh it's a compile-time option.
Regarding the POSIX sh I say: either add this feature or let braces
parse like parentheses.  In the latter case the only difference between
them would be: a parenthesized expression evaluates in a subshell, a braced
expression evaluates in the current shell (*always*, even if the input or
output of the list has been redirected; in current implementations such
redirections cause evaluation in a subshell).
--
 1) Will 4.5BSD have wait5()?         |Maarten Litmaath @ VU Amsterdam:
 2) Sleep(3) should be sleep(2) again.|maart@cs.vu.nl, uunet!mcsun!botter!maart

Volume-Number: Volume 19, Number 73