May 2017
Beginner
552 pages
28h 47m
English
Arrays can be defined using different techniques:
array_var=(test1 test2 test3 test4)
#Values will be stored in consecutive locations starting
from index 0.
Alternately, define an array as a set of index-value pairs:
array_var[0]="test1"
array_var[1]="test2"
array_var[2]="test3"
array_var[3]="test4"
array_var[4]="test5"
array_var[5]="test6"
echo ${array_var[0]}
test1
index=5
echo ${array_var[$index]}
test6
$ echo ${array_var[*]}
test1 test2 test3 test4 test5 test6
Alternately, you can ...