bash-like arrays with busybox / ash
Roy Marples
roy at marples.name
Thu Mar 12 13:18:08 UTC 2009
Guenter wrote:
> Hi all,
> I just suprisingly found that latest busybox 1.13.3 seems not yet
> support arrays like bash does, f.e. something like:
>
> #!/bin/ash
> url='http://....'
> files=(`wget -q -O - $url`)
> for ((i=0; i<${#files[*]}; i++)); do
> echo "$i - ${files[$i]}"
> done
>
> returns:
> ./getlist: line 3: syntax error: "(" unexpected
You can use arrays with any shell with a little thought
#!/bin/ash
url='http://....'
set -- `wget -q -O - $url`
i = 0
for file; do
echo "$i - $file"
i=$(($i + 1))
done
DISCLAIMER: The above was typed directly into an email and not actually
tested.
> are there any plans to implement arrays soon?
Hopefully there are no plans to implement any bash specific features :)
Thanks
Roy
More information about the busybox
mailing list