On Thu, Sep 25, 2014 at 3:53 AM, Greg Wooledge <wool...@eeg.ccf.org> wrote: > On Thu, Sep 25, 2014 at 03:44:23AM +0800, lolilolicon wrote: >> Otherwise, if this feature is going to stay (can anyone enlighten me why >> it's useful?), please document it explicitly. > > First, it is documented: > > Functions may be exported so that subshells automatically have them > defined with the -f option to the export builtin. > > (Good luck finding that if you didn't know to look for it, though.)
Yeah, I did find that part. But it does not specify *how* it's done, i.e. there is no mention of '() {', and by reading the above, one wouldn't expect my first example to work. > > Second, it's "useful" in niche cases like this: > > foo() { ...; } > export -f foo > find . -type f -exec bash -c 'for f; do foo "$f"; done' _ {} + Oh, this command line feels so wrong... > > So, if Chet removes the feature, it would probably break something that > someone cares about. Maybe there could be a compile-time option to > disable it. Maybe there already is -- I didn't look. I don't expect more than a dozen who rely on this... but bash programmers can be quite the perverts, so...