Unix Arrays
Array Declarations
ARRAYNAME[INDEXNR]=value
or
ARRAYNAME=(value1 value2 …. valueN)
or
ARRAYNAME=([1]=10 [2]=20 [3]=30)
Defining Array Values
a[0]=1
a[2]=90
a[3]=100
a[4]=85
a[5]=65
To Print Single Element
echo ${arr[0]}
echo ${arr} – Prints first Element
To Print Array Value in Shell Script
#! /bin/bash
# To declare static Array
arr=(nishant vaibhav rishabh abhishek puneet)
# To print all elements of array
echo ${arr[@]}
echo ${arr[*]}
echo ${arr[@]:0}
echo ${arr[*]:0}