#/bin/bash
a=(9 84 51 0 345 1 2 34 1 0)
#自己定义一个数组
temp=
for((i=0;i<10;i++))
{
for((j=i;j<10;j++))
{
x=${a[$i]}
if test $x -ge ${a[$j]}
then
temp=${a[$i]}
a[$i]=${a[$j]}
a[$j]=$temp
fi
}
}
for((k=0;k<10;k++))
{
echo -n ${a[$k]} " "
}
echo
#/bin/bash
a=(9 84 51 0 345 1 2 34 1 0)
#自己定义一个数组