Area of Rectangle = Length x Breadth
#/bin/bash
#Shell Script to find the area of rectangle
echo "Enter the length of the rectangle:"
read length
echo "Enter the breadth of the rectangle:"
read breadth
area=`expr $length \* $breadth`
echo "Area of Rectangle = $area"
2.Write a script to find the area of square
#!/bin/bash
#script to find area of a square based on user input
if [ $# -ne 1 ]
then
echo " Usage -$0 x "
echo " where x is the dimension of the square "
exit 1
fi
n1=$1
echo " Area of the square is equal to `expr $n1 \* $n1` "
Comments
Leave a comment