Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Apr 2010 11:36:59 -0400
From:      Ed Maste <emaste@freebsd.org>
To:        Jilles Tjoelker <jilles@FreeBSD.ORG>, src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG
Subject:   Re: svn commit: r207206 - head/bin/sh
Message-ID:  <20100428153659.GA42914@sandvine.com>
In-Reply-To: <20100427035224.GA87611@nagual.pp.ru>
References:  <201004252043.o3PKhJi7065713@svn.freebsd.org> <20100427035224.GA87611@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 27, 2010 at 07:52:25AM +0400, Andrey Chernov wrote:

> Just wonder, do you have plans to implement ${!variable} sometimes?
> This bashism is very useful:
...

While we're on this topic, I'll mention the bashism I'd like to see
support for -- array variables.

Older versions supported only one-dimensional numeric indicies.
http://tldp.org/LDP/abs/html/arrays.html

foo[1]=abc
foo[2]=def
echo ${foo[1]} ${foo[2]}


Bash 4 adds associative arrays.

foo[bar]=ghi
foo[baz]=jkl

echo ${foo[bar]} ${foo[baz]}
echo ${foo[*]}

-Ed



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100428153659.GA42914>