RFC: proposed new builtin for /bin/sh (associative arrays)

Nicolas Rachinsky list at rachinsky.de
Sat Nov 1 04:03:49 PST 2003


* Oliver Fromme <olli at lurza.secnetix.de> [2003-10-31 21:16 +0100]:
> Maybe I'm not understanding your intentions, but isn't that
> already possible using "set | sed -n '/^foo_/s/=.*//p'"?
> 
> Or do you want to avoid external programs?  In that case it
> would be a little bit more difficult to do, but it's still
> possible to do with existing builtins:
> 
> indexes()
> {
>     for i in `set`; do
>         case $i in
>             $1*) echo ${i%%=*}
>         esac
>     done
> }

I think both of these could fail with multiline values.

Nicolas


More information about the freebsd-hackers mailing list