#!/bin/ksh #One way to create an array. The name of this array is a. a[0]=morning a[1]=noon a[2]=evening echo ${a[0]} #curly braces in Handout 4, p. 7 echo ${a[1]} echo ${a[2]} echo for e in ${a[*]} #${a[*]} is all the elements do echo $e done echo i=0 while [[ $i -lt ${#a[*]} ]] #${#a[*]} is the number of elements do echo Element number $i is ${a[$i]}. let i=i+1 done echo #Another way to create an array. The name of this array is animal. set -A animal \ monkey rooster dog pig rat ox tiger hare dragon snake horse sheep n=${#animal[*]} echo The $n animals are echo ${animal[*]} echo The third animal is the ${animal[2]}. #/ is quotient, % is remainder. year=`date | awk '{print $6}'` echo $year is the year of the ${animal[$year % $n]}.