#!/bin/bash
swap(){
temp=${array[$1]}
array[$1]=${array[$2]}
array[$2]=$temp
return
}
echo "Please input some number"
read -a array
length=${#array[@]}
#echo $length
for (( i = $length - 1 ; i > 0 ; i-- ))
do
for (( j = 0 ; j < i ; j++ ))
do
a=${array[$j]}
b=${array[$((j+1))]}
if [ "$a" -gt "$b" ]; then
swap $j $((j+1))
fi
done
done
echo "${array[@]}"