Bekijk de volledige versie : dividing
I would like to divide 2 numbers in script. I do it with comand
a=$(($b/$c))
but the result is an integer number and i want to get real number. Is it possible to do it in script without using python etc.?
I would like to divide 2 numbers in script. I do it with comand
but the result is an integer number and i want to get real number. Is it possible to do it in script without using python etc.?
The traditional way to do this on Unix systems is with bc e.g.
#echo "5 / 3" | bc -l
1.66666666666666666666
However, I doubt that bc is supplied on these minimal Linux based firmwares.
The traditional way to do this on Unix systems is with bc e.g.
#echo "5 / 3" | bc -l
1.66666666666666666666
However, I doubt that bc is supplied on these minimal Linux based firmwares.
Ok i have installed BC, but how could I define the precision of the number?
I would like to divide 2 numbers in script. I do it with comand
but the result is an integer number and i want to get real number. Is it possible to do it in script without using python etc.?
Use awk then.