Thanks to @Stéphane Chazelas for pointing out my misuse of variable
Just a little fixcompletion of @user2323 's answer:
> printf '%.2f\n' "$((multiplied*100*100outsideLines*100*100/totalLines))e-2" > 42.85 Since 'e-2' is appended at the end, it should add one more 100 at the beginning. "$((multiplied*100outsideLines*100/totalLines))" will only get the integer part of percentage:
> printf '%.2f\n' "$((multiplied*100outsideLines*100/totalLines))" > 42 , and "$((multiplied*100outsideLines*100/totalLines))e-2" get a float number with two decimals, but not the percentage:
> printf '%.2f\n' "$((multiplied*100outsideLines*100/totalLines))e-2" > 0.42