tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Empty sub-shells and command groups in /bin/sh

On Tue, May 17, 2016 at 04:05:57PM +0000, Christos Zoulas wrote:
 > In article <>,
 > Robert Elz  <kre%munnari.OZ.AU@localhost> wrote:
 > >The posix shell standard does not allow empty sub-shells, or command
 > >groups.   That is, both
 > >	( )
 > >and
 > >	{ }
 > >(even if you write the latter as "{ ; }" though it turns out the ';'
 > >there is not actually required, as it, or a \n, usually is before '}')
 > >are both syntax errors.
 > [stuff deleted]
 > >ps: various other places, beyond the one from PR bin/48489 (which is
 > >fixed already I believe) where empty "commands" were permitted will also
 > >get corrected by this fix.
 > I think we should probably have "strict posix mode" for this (via an
 > environment variable or command line switch?) ...
 > Allowing relaxed syntax like this is convenient.

For braces, yes - that is at least semantically sensible. For a
subshell, I'd say not so much.

Also, accepting invalid syntax that other shells reject eventually
bites us.

David A. Holland

Home | Main Index | Thread Index | Old Index