O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Array Variables

One-dimensional arrays are supported by the Korn shell. On most systems, arrays can have a maximum of 512 elements. Array subscripts start at 0 and go up to 511. Any variable can become an array by simply referring to it with a subscript.

Array Variable Assignment Format

variable[0]=value variable[1]=value... variable[n]=value

set –A variable value0 value1... valuen

typeset variable[0]=value variable[1]=value... variable[n]=value
assign values to array variable elements
set +A variable value0 value1... valuenreassign values to array variable elements
typeset –attributes variable[0]=value variable[1]=value... variable[n]=valueassign attributes and values to array variable elements
typeset –attributes variableassign attributes to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required