Korn Shell. Unix and Linux Programming Manual, Third Edition

   

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

By Anatole Olczak

Table of Contents
Appendix G.  Pdksh Quick Reference

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

reassign values to array variable elements

typeset ?/span>attributes variable[0]=value variable[1]=value... variable[n]=value

assign attributes and values to array variable elements

typeset ?/span>attributes variable

assign attributes to array variable

typeset +attributes variable

remove attributes from array variable (except readonly)

Array Variable Evaluation

${array}, $array

array element zero

${array[n]}

array element n

${array[*]}, ${array[@]}

all elements of an array

${#array[*]}, ${#array[@]}

number of array elements

${#array[n]}

length of array element n


       
    Top
     

    Категории