In article <[email protected]>, [email protected] (Denys Vlasenko) wrote:
> *From:* Denys Vlasenko <[email protected]> > *To:* Ralf Friedl <[email protected]> > *CC:* [email protected] > *Date:* Tue, 8 Feb 2011 18:32:14 +0100 > > On Tue, Feb 8, 2011 at 3:33 PM, Ralf Friedl <[email protected]> > 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 > [email protected] > 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 :-( _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
