原文:http://bash.cyberciti.biz/shell-math/calulate-area-circumference-of-circle/
圆的命名

以下是该shell脚本的源代码:Sample Shell Script
#!/bin/bash
# Shell script to calulate area and Circumference of circle.
# It take radius of a circle as input.
# -------------------------------------------------------------------------
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# ----------------------------------------------------------------------
# Lesson on Circumference of a Circle :
# Visit http://www.mathgoodies.com/lessons/vol2/circumference.html
echo -n "Enter the radius of a circle : "
read r
# use formula to get it
area=$(echo "scale=2;3.14 * ($r * $r)" | bc)
# use formula to get it
d=$(echo "scale=2;2 * $r"|bc)
circumference=$(echo "scale=2;3.14 * $d"| bc)
echo "Area of circle is $area"
echo "Circumference of circle is $circumference" |