< Shell Programming

To assign a value to an element of an array simply do

ArrayName[2]=ValueForArrayNameIndex2

To expand the value of an index of an array do

${ArrayName[2]}   # This equals 'ValueForArrayNameIndex2'

The arrays don't need to be full or compact (i.e. there can be null values between some interval of indexes).

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.