Can I set up my own sub-environment?

David Collier from_busybox_maillist at dexdyne.com
Tue Feb 8 18:31:00 UTC 2011


In article <AANLkTi=rN-nFbqiO6h2z-G-Ogsh=qua3nJ2_u-_0LH65 at mail.gmail.com>,
vda.linux at googlemail.com (Denys Vlasenko) wrote:

> *From:* Denys Vlasenko <vda.linux at googlemail.com>
> *To:* Ralf Friedl <Ralf.Friedl at online.de>
> *CC:* busybox at busybox.net
> *Date:* Tue, 8 Feb 2011 18:32:14 +0100
> 
> On Tue, Feb 8, 2011 at 3:33 PM, Ralf Friedl <Ralf.Friedl at online.de> 
> wrote:
> > David Collier schrieb:
> >>
> >> bash _allows_ the round brackets as in
> >>
> >> func2 () {
> >> }
> >>
> >> but on further examination, they are apparently redundant 
> syntax!!!!!
> >>
> >> ( If that's right, would it be reasonable to make ash ignore 
> them too -
> >> it would allow easier porting to ash from bash. )
> >>
> >> I must admit I had mistakenly thought that the way of invoking 
> functions
> >> with parameters in bash required use of round brackets, but I 
> now see it
> >> isn't so.
> >>
> >
> > Are you sure? From "man bash":
> >   [ function ] name () compound-command [redirection]
> > There is no indication of "()" being optional. Actually it would 
> > be
> > interpreted as a call of "func2", followed by other statements, 
> > so it's not
> > possible to define a function this way.
> >
> > On the other hand, "help function" says:
> >   function name { COMMANDS ; } or name () { COMMANDS ; }
> > so "()" may be optional after the keyword "function".
> > Actually this contradicts each other, because according to the 
> > manual, "()"
> > is required, while according to the help, it is not allowed.
> 
> My man bash says:
> 
> "[ function ] name () compound-command [redirection]
> ...
> If the function reserved word is supplied, the parentheses are 
> optional..."
> 
> bash extensions can be divided into generally useful ones (like 
> arrays,
> process redirection <(cmd), -o pipefail...) and pure featuritis 
> which only
> causes new generations of admins (who did yet grasped the importance
> of following standards) to gratuitously use them. function keyword
> is clearly in the second category.
> 
> -- 
> vda
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
> 

I can see Denys' argument that bash is doing it wrong/badly/clumsily -
but if it means I can't write a script that runs on both without being
edited, then I don't care who's right, I'm unhappy :-( 



More information about the busybox mailing list