Исправление
snoopcat,
(текущая версия)
:
annelin@nevermore ~ » cat igor.sh
#!/bin/bash
round()
{
echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc))
};
total=137
linux_and_steamos=56
round `echo "$linux_and_steamos/$total*100" | bc -l` 0
annelin@nevermore ~ » time ./igor.sh
41
real 0m0.004s
user 0m0.002s
sys 0m0.002s
where is your god now? ☺
Исходная версия
snoopcat,
:
annelin@nevermore ~ » cat igor.sh
#!/bin/bash
round()
{
echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc))
};
total=137
linux_and_steamos=56
round `echo "$linux_and_steamos/$total*100" | bc -l` 0
annelin@nevermore ~ » time ./igor.sh
41
real 0m0.004s
user 0m0.002s
sys 0m0.002s
where is your god now? ☺