On 07/18/2014 06:03 PM, Assaf Gordon wrote:

> 
>     $ /bin/sh -c 'test() { local i=1 ; echo $i ; } ; test'
>     /bin/sh[1]: local: not found [No such file or directory]
> 

'local' is not a POSIX shell construct.  It is not portable to write
/bin/sh scripts and expect local to work.  The workaround is simple -
don't use local variables, and just be sure to namespace your variables
so that your functions don't inadvertently collide with the rest of your
script.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to