[BusyBox] ash arrays
Charles Steinkuehler
charles at steinkuehler.net
Thu Jul 22 11:27:04 MDT 2004
Oops...forgot to include the list in my earlier reply...
Yan Yanovsky wrote:
> Hello everyone!
> I'm trying to declare and use one dimmension array in ash.
> The Bash way doesn't, so if anyone knows how to use arrays in ash,
> please let me know..
There is no direct support for arrays in ash...you have to use eval,
setvar, etc:
- To set varibles:
for index in 1 2 3 ; do
setvar myvar$index "Index: $index"
eval myothervar$index=\"Index: $index\"
done
- To use variables:
for index in 1 2 3 ; do
eval echo \$myvar$index
done
index=2
eval assign="\$myvar$index"
echo $assign
NOTES:
------
- Be careful with quoting when using eval!
- Bash doesn't have the setvar command, so you might want to stick with
using eval
--
Charles Steinkuehler
charles at steinkuehler.net
More information about the busybox
mailing list