🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #201

Re: { and } with for in /bin/sh

#201
From: Moderator, John S. Quarterman
Date: Thu, 05 Apr 1990 22:35
28 lines
1892 bytes
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
Technical Details
Message-ID: <643@longway.TIC.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!longway!std-unix
References: <237@sherpa.UUCP> <12430@smoke.BRL.MIL> <1990Mar26.193433.13320@smsc.sony.com> <528@ehviea.ine.philips.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!snorkelwacker!apple!longway!std-unix
From: std-unix@longway.TIC.COM (Moderator, John S. Quarterman)
Newsgroups: comp.std.unix
Subject: Re: { and } with for in /bin/sh
Message-ID: <643@longway.TIC.COM>
Date: 5 Apr 90 22:35:00 GMT
References: <237@sherpa.UUCP> <12430@smoke.BRL.MIL> <1990Mar26.193433.13320@smsc.sony.com> <528@ehviea.ine.philips.nl>
Reply-To: Maarten Litmaath <uunet!cs.vu.nl!maart>
Organization: VU Informatika, Amsterdam, The Netherlands
Lines: 28
Approved: jsq@longway.tic.com (Moderator, John S. Quarterman)