- #!bin/bash
- echo "Enter limit:"
- read n
- echo "Enter the numbers"
- for((i=0;i<n;i++))
- do
- read a[i]
- done
- echo "Numbers before sorting"
- echo ${a[@]}
- for((i=0;i<n;i++))
- do
- for((j=i+1;j<n;j++))
- do
- if [ ${a[i]} -gt ${a[j]} ]
- then
- t=${a[i]}
- a[i]=${a[j]}
- a[j]=$t
- fi
- done
- done
- echo "Numbers after sorting"
- echo "${a[@]}"