Como faço para obter este pequeno script bash para mostrar a peça “$ (($ ((h + l)) / divider))” em formato decimal?

0
#!/bin/bash
h=0
l=0
n=0
reads=0
divider=6
while read user_input; do
    ((reads++))
    [ "$user_input" -eq 1 ] && ((l++))
    [ "$user_input" -eq 2 ] && ((n++))
    [ "$user_input" -eq 3 ] && ((h--))
    if [ "$((reads%52))" -eq 0 -a "$divider" -gt 1 ]; then
        ((divider--))
    fi
    echo "      True Count $(($((h+l))/divider))    High cards $h/120   Null Cards $n/72   Low Cards $l/120"
done
    
por Wolfgang Steele 03.03.2018 / 01:13

1 resposta

1

Tente isso usando

#!/bin/bash
h=0
l=0
reads=0
divider=6
while read user_input; do
    ((reads++))
    ((user_input == 1 && h++))
    ((user_input == 2 && n++))
    ((user_input == 3 && h--))
    if ((reads%52 == 0 && divider > 1)); then
        ((divider--))
    fi
    echo "True Count $(bc <<< "scale=3; ($h+$l)/$divider") High cards $h/120 Null Cards $n/72 Low Cards $l/120"
done
    
por 03.03.2018 / 01:22