#!/bin/bash array=('Lin' 'Chen') array[2]="Yanhua" echo ${array[0]} echo ${array[1]} echo ${array[*]} echo ${array[@]} for i in ${array[*]} do echo $i done array2=("${array[@]}") # create a copy array2[0]="Chen" echo ${array[@]} echo ${array2[@]} echo ${#array[@]} # 3, array size array=(a b c d e f g h i j) echo ${array[@]:3:2} # prints d e