Reverse elements of an Array in Linux

In this blog, sharing code to reverse the array elements. arr=(1 2 3 4) ## Array of 4 Elementsarr_2=() ## Another Array of zero Elements or you can say blank Arraylen=${#arr[@]} ## It gives the length of an Array arrwhile [ $len -gt “0” ]dolen=$(( $len – 1))arr_2+=(${arr[len]})doneecho ${arr_2[*]} ##It will print (4 3 2 1)