• [^] # Re: Non c'est pas si con.

    Posté par . En réponse au message Comparaison de deux entiers sous bash. Évalué à 2.

    Comme il faut toujours aller au bout de ce qu'on a commencé :


    #!/bin/bash
    function TriCroissant {
    i=0
    while [ ! -z "1ドル" ]
    do
    MatriceBrute[$i]=1ドル
    i=$((i+1))
    shift
    done
    MatriceTrie=($(echo ${MatriceBrute[@]} | tr ' ' '\n' | sort -k1,1n | paste -s -d ' ' ))
    ListeCroissante=${MatriceTrie[0]}
    for ((j=1 ; $i - $j ; j++))
    do
    [ $(bc -l <<< "${MatriceTrie[$((j-1))]} == ${MatriceTrie[$j]}") -eq 1 ] && \
    ListeCroissante=$ListeCroissante$" <= "${MatriceTrie[$j]} || \
    ListeCroissante=$ListeCroissante$" < "${MatriceTrie[$j]}
    done
    echo $ListeCroissante
    }



    >TriCroissant -2.0 3.5 4.1 15.052556

    -2.0 < 3.5 < 4.1 < 15.052556