{ and } with for in /bin/sh
Maarten Litmaath
maart at cs.vu.nl
Fri Apr 6 08:31:52 AEST 1990
In article <528 at ehviea.ine.philips.nl>,
leo at 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 at cs.vu.nl, uunet!mcsun!botter!maart
More information about the Comp.unix.questions
mailing list