On 07/07/2012 02:42 PM, Jim Meyering wrote: >> +function massage_git_version() { >> + local v=$1 > > Using the "function" and "local" keywords would make this script > fail for some older shells. I'd like to remain portable to those.
Not just older shells. POSIX does not require either 'function' or 'local', so they cannot be portably used. foo() { ...; } is the portable alternative that avoids 'function'. There is no portable way to do scope limiting of function variables. I'd like to add either 'local' or 'typeset' to the next version of POSIX, but Chet Ramey (bash) and David Korn (ksh) have a strongly divided opinion on whether dynamic (bash) or static (ksh) scoping should be standardized. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature