Question
shell script. I am doing a BMI calculator and there are errors from the if statament from the beginning to the end. Please help me
shell script. I am doing a BMI calculator and there are errors from the if statament from the beginning to the end. Please help me fix it. How can I use the variable x y z to hold floating point? I will be give like if help me add more code with explaination. Thanks.
cho -e "Welcome to the BMI calculator " echo "please enter your weight in pounds: " read weight echo "please enter your your height in inches: " read height
let total_weight=$weight*703 let total_height=$height*$height let BMI=$total_weight/$total_height echo "your weight is $weight in pounds" echo "your height is $height in inches" echo "--------------------------------" echo "your BMI is: $BMI"
x=18.5 y=24.9 z=29.9 if [ $BMI -le $x ] then echo "your BMI is $BMI. You are underweigyt" elif [ $BMI -le $y ] then echo "your BMI is $BMI. You are normal" elif [ $BMI -le $z] then echo "Your BMI is $BMI. YOu are overweight " else echo "You BMI is $BMI. You are Obese" fi
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started