svn commit: r207206 - head/bin/sh

Ed Maste emaste at freebsd.org
Wed Apr 28 15:37:01 UTC 2010


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


More information about the svn-src-all mailing list