Skip to content
Advertisement

how to calculate percentage in shell

I would like to calculate percentage in shell. But I can’t do it. My script is

JavaScript

It is neither showing any value nor terminating when executing this script.

Advertisement

Answer

awk will give you an n1 illegal field name if you do that, as it’s inside single quotes. Also, to avoid awk keep reading stdin you should pass /dev/null as file. Then:

JavaScript
Advertisement