mardi 27 mars 2018

Comparing 2 Arrays with sum values

I have an Array filled with sum values of the numbers 1 to 10 and in a for loop i want to check the array for duplicates but these values are e.g. 00034 1 which are 2 numbers so the error message i get is "too many arguments" how can i change it? Code:

        while [ $k -le 10 ]
        do
            #the line below is the problem i is the value of another
            #loop the list is in
            if [ ${sumList[i]} -e ${sumList[k]} ]
            then
                    if [$k != $i]
                    then
                            echo "collision k: $k mit i: $i"
                    fi
            fi
            k=$(($k+1))
    done

Aucun commentaire:

Enregistrer un commentaire