#!/bin/bash
  
arr=(90 23 73 11 5 31 129 678 7 5)
j=0
temp=0
values=10
# Declaring function
max () {
 j=$1
        if [ $j -lt $values ]
        then
                if [ ${arr[j]} -gt $temp ]
                then
                    # swap
                    temp=${arr[j]}
                    ((j++))
                    max $j
                else
                    ((j++))
                    max $j

                fi

        fi
        }

echo "Array in original order"
echo ${arr[*]}

# calling function max
max 1

echo "Maximum value is:"
echo $temp
