Hi,
in my ksh script
expr 22 / 10 results as 2
but the actual result expected in 2.2.
how do i get that result. Please help
Thanks,
Hi,
in my ksh script
expr 22 / 10 results as 2
but the actual result expected in 2.2.
how do i get that result. Please help
Thanks,
/ is integer division
% modulus
may be you can use awk
awk 'BEGIN{print (22/10) }'
with parameters
awk -v a=$1 -v b=$2 '{print (a/b) }'
or
echo $number |awk '{print ($1/10)}'
expr works with integers.
# echo 'scale=2;22/10' |bc
2.20