calculating the area of a circle with bc

Tony Arnold tony.arnold at manchester.ac.uk
Sun Mar 28 19:55:45 UTC 2010


Loic,

Loïc Grenié wrote:

>   (scale=2 or 4 might be sufficient for your purpose). As said elsewhere,
>   you can eliminate the "a(1)"
> 
> echo "scale=4;$2/$1^2" | bc -l

And to be pedantic you don't need the -l option for the above:

echo "scale=4;$2/$1^2" | bc

Regards,
Tony.
-- 
Tony Arnold,                        Tel: +44 (0) 161 275 6093
Head of IT Security,                Fax: +44 (0) 870 136 1004
University of Manchester,           Mob: +44 (0) 773 330 0039
Manchester M13 9PL.                 Email: tony.arnold at manchester.ac.uk




More information about the ubuntu-users mailing list