Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Aliases Up: Shell Variables, Aliases and Previous: Variables   Contents

Arrays

The Korn shell and bash support one-dimensional arrays. These needn't be defined beforehand. Elements can be assigned individually (for example name[3]=diana) or en masse.

colors[1]=red 
colors[2]=green 
colors[3]=blue

echo The array colors has ${#colors[*]} elements.
echo They are ${colors[*]}



Tim Love 2010-04-27