#!/bin/sh
read -p "Enter the width and height of rectangle in meters: " width height
sqm=$(echo "$width * $height" | bc -l)
sqin=$(echo "$sqm * 1550" | bc -l)
echo "Area of the rectangle is: $sqm Square Meters or $sqin Square Inches."
(FYI, 1 metro quadrado é 1550 polegadas quadrados. Eu sei disso porque o Google me diz isso.)
Execução da amostra:
$ ./area.sh
Enter the width and height of rectangle in meters: 3.5 4.5
Area of the rectangle is: 15.75 Square Meters or 24412.50 Square Inches.