ARRAY=( "engineer " "CEO" "doctor" "teacher" )
for i in "${!ARRAY[@]}"
do
echo " index---------------content"
echo " $i ${ARRAY[$i]}"
done
#!/bin/bash
a=()
b=("reason" "logic" "aspect" "ethic")
echo ${b[2]}
#!/bin/bash
AR=([3]='foo' [5]='bar' [25]='baz' [7]='bat')
for i in "${!AR[@]}"; do
printf '${AR[%s]}=%s
' "$i" "${AR[i]}"
done
ss="abcdefghi"
my_array=( `echo $ss | grep -o . ` ) # split word into array
echo ${my_array[2]}
give c
i=0
echo ${my_array[$i]}${my_array[$i+1]}xxx
give : abxxx