On Mon, 2014-09-29 at 08:03 +0200, Matthias Urlichs wrote: > Russell Stuart: > > > > > > - array variables. > > > > No workaround for this one? Pity. This is what usually prevents > > conversion. > > Well, you could use $ary_len to remember the length of the array, > "$(eval "echo \"\$ary_$pos\"")" > for retrieving values, and > val="some random value which probably requires quoting when eval'd" > eval "ary_$pos=\"\$val\"" > for assigning to individual members. > > Package that in a couple of helper functions and it looks almost sane. :-/
For some versions of sane I guess. The major reason for having an array is to be able to go "${array[@]}" somewhere, and have the quoting automagically work. Like all successors of the original /bin/sh, dash does have to support arrays for its argument processing: supporting "$*", "$@", "$#" and shift off the top of my head. You can bend it to your own purposes to some extend using "set --- val1 val2 ...". I suspect some think adding arrays is a big change, introducing new concepts to dash. But it isn't really. All it really does is allow you to have named argument lists in addition to the built in one. And most uses I have found for them are in that vein as well - building up argument lists for commands, without having to descend into eval/quoting hell.
signature.asc
Description: This is a digitally signed message part