[comp.unix.questions] arrays in sh

maart@cs.vu.nl (Maarten Litmaath) (08/08/90)

In article <637@travis.csd.harris.com>,
	brad@SSD.CSD.HARRIS.COM (Brad Appleton) writes:
)...
)	2) set a shell variable to a word-list (or an array)
)...
)     sh                       ksh                    csh
)  -------------------   ----------------------   --------------------------
)...
)2)    N/A               set -A name el1 el2 ...  set name=( el1 el2 ... )

To emulate arrays in sh the following constructs can be used:

	# to set `array[index]'
	eval array$index=\$value

	# to retrieve it
	eval value=\$array$index
--
   "UNIX was never designed to keep people from doing stupid things, because
    that policy would also keep them from doing clever things."  (Doug Gwyn)