Open main menu

Wikibooks β

Shell Programming/Arrays

< Shell Programming

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


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).