Space character in rc.conf variable

Mark Johnston markjdb at gmail.com
Sat Oct 30 22:40:19 UTC 2010


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 ${#arr[@]} 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


More information about the freebsd-hackers mailing list