NetBSD-Bugs archive

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

Re: bin/51145: /bin/sh accepts '()' as a valid sub-shell



The following reply was made to PR bin/51145; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51145: /bin/sh accepts '()' as a valid sub-shell
Date: Mon, 16 May 2016 12:15:24 +0700

 To add to my own report, the same problem exists with
 
 	{ }
 
 (and to both of these forms with a newline between -  which shouldn't
 make a difference, and doesn't).
 
 It is interesting that zsh does not object to the form using { (bash
 and dash both do - which mostly guarantees most scripts do not use it.)
 
 One effect that fixing this might have on some people/scripts is that
 it will no longer be possible to make a truly empty function, like
 
 f() {
 }
 
 bash and dash don't permit that, other shells (including NetBSD's) do.
 The shell grammar (in
    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
 does not permit any of this either.)
 
 The empty function "rewrite" is 
 
 f() { :
 }
 
 or any equivalent form, like: f(){ :;}
 


Home | Main Index | Thread Index | Old Index