Odwróć tablicę w skryptach Bash
#Array declaration
array=(1 2 3 4 5 6 7)
# Declaring index for updated reversed array
min=0
# Length of the array
max=$(( ${#array[@]} -1 ))
# Run while loop untill and unless min is less than max
while [[ min -lt max ]]
do
# Swap current first and last elements
x="${array[$min]}"
array[$min]="${array[$max]}"
array[$max]="$x"
# Move closer
(( min++, max-- ))
done
# Printing reverse array
echo "${array[@]}"
Soumyaranjan Rout