Remove duplicate in array

Hi,

I have a list of numbers stored in an array as below.

5 7 10 30 30 40 50

Please advise how could I remove the duplicate value in the array ?

Thanks in advance.

What language/shell is this happening in?

I am using shell script. I tried to use "sort -u", but it seems to be not working.

Hope this helps:

typeset -i x=5
typeset -i i=0
typeset -i j=0
typeset -i y=0
array[0]=1
array[1]=2
array[2]=2
array[3]=3
array[4]=4

i=0
while (( i < x )); do

        (( j = i + 1 ))
        while (( j < x )); do
                if [ ${array} = ${array[j]} ]; then
                        break
                fi

                (( j = j + 1 ))
        done

        if [ $j = $x ]; then
                newarr[y]=${array}
                (( y = y + 1 ))
        fi
        (( i = i + 1 ))
done

i=0
while (( i < y )); do

        echo "${newarr}"
        (( i = i + 1))
done

Thanks a lot

set -A new_array `echo ${old_array[*]} | tr ' ' '\012' | sort -u`

Or, if you don't want things sorted, substitute "uniq" for "sort -u"