From: Eric Blake <eblake@redhat.com>
To: Aragon Gouveia <aragon@phat.za.net>
Cc: dash@vger.kernel.org
Subject: Re: setvar MIA?
Date: Tue, 11 Jan 2011 10:00:33 -0700 [thread overview]
Message-ID: <4D2C8CB1.4070204@redhat.com> (raw)
In-Reply-To: <4D2C8B2C.3060001@phat.za.net>
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
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@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2011-01-11 17:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-11 15:54 setvar MIA? Aragon Gouveia
2011-01-11 16:10 ` Eric Blake
2011-01-11 16:54 ` Aragon Gouveia
2011-01-11 17:00 ` Eric Blake [this message]
2011-01-11 19:58 ` Jilles Tjoelker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D2C8CB1.4070204@redhat.com \
--to=eblake@redhat.com \
--cc=aragon@phat.za.net \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.