I am trying to write a basic script to calculate the radius and area of โโa circle, where PI = 3.14, and the circle is given. I am very new to scripting and I cannot figure it out.
#!/bin/bash
PI=3.14
CIRC=5
RAD=echo "((CIRC/2*PI))" | bc-l
printf "Radius: %.2f" $RAD
AREA=echo "((PI*RAD**2))" | bc-l
printf "Area: %.2f" $AREA
The sum of both equations is not stored in these variables, and I have no idea why. Hope someone can help explain.
source
share