#!/bin/bash

declare -a TOMB
TOMB=(9 8 7 6 5 4 3 2 1 33 11 32 12 17)

function change()
{
    local temp=${TOMB[$1]}
    TOMB[$1]=${TOMB[$2]}
    TOMB[$2]=$temp
    return
}

function sort()
{
    number=${#TOMB[@]}
    comp=$(($number - 1))
    count=1
    while [ $comp -gt 0 ]
    do
	index=0
	while [ $index -lt $comp ] 
        do
    	    if [[ ${TOMB[$index]} -gt ${TOMB[$(($index + 1))]} ]]
            then
        	change $index $(($index + 1))
            fi  
            index=$((index+1))
        done 
        comp=$((comp-1))
        count=$((count-1))
    done
}

sort 
echo ${TOMB[@]} > cki
command sort cki
rm cki




