On Sun, Oct 31, 2010 at 12:08:28AM +0200, Jilles Tjoelker wrote:
> Array support in the shell could make this easier, but not much unless
> the rc.conf syntax would be changed as well, like
>   ifconfig_wlan0=(ssid "SSID WITH SPACE" dhcp)
> but then changed some more such that "DHCP" can be used as SSID.
> 
> Array support would add a fair bit of code to sh, and even then it will
> remain fairly limited and clumsy. For example, an array can only be
> returned from a function by passing the name of an existing array to
> place the result in and using eval, extending setvar in some strange way
> or implementing another ksh93 extension, namerefs.
> 
> -- 
> Jilles Tjoelker

Incidentally, I've actually been working on this, though it was more for
fun than anything else - my impression is that new features for sh(1)
are generally unwelcome because of the testing required and the
possibility of regressions. I have some of the syntax working, e.g.

$ foo[1]=one
$ foo[2]=two
$ foo[3]=three
$ echo ${foo[1]} ${foo[2]} ${foo[3]}
one two three
$ unset foo[2]
$ echo ${foo[1]} ${foo[2]} ${foo[3]}
one three

It was while working on the ${#a...@]} syntax that I ran into
bin/151720.

If people are actually interested in this, I can discuss my changes in
more detail. The actually array implementation is quite simple, around
200 LOC... a number of changes to var.c, parser.c and eval.c are
necessary however.

-Mark
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to