On 01/11/2011 09:54 AM, Aragon Gouveia wrote: > I wasn't sure of its status in POSIX. It is useful for declaring > variable variables - tidier than eval and I imagine faster, eg. > > index="1" > setvar var_${index} "value" > > Will emulate it with a local function - thanks. Indeed, it looks like FreeBSD introduced it as shorthand for: setvar() { eval $1=\$2; } The speed difference between that function doing an eval and a shell builtin would be in the noise. I don't know why FreeBSD even bothered to pollute the namespace with a builtin like that. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature