I have a script that tells the user the square footage of 2 rooms based on user input. I think I have that part done right. The problem I have is that I need to have the script say which room is bigger and no matter how I try to rebuild the end of the script I get both responses, 1 of the responses which is wrong unless the user is lucky, or I get no response. How do I change this part of the script to get the correct output? I'll have the rest of the script as a reply to this for those that want to skip over the working part along with the question I've been given. Also this is a homework assignment from my Intro to Unix class that I've spent way to much time on trying to figure out so the correction has to be somewhat beginner-ish.
if [ $R1z -ge $R2z] then echo Room 1 is bigger else echo Room 2 is bigger fi
All of the code:
echo Enter the length of room 1 read R1x echo Enter the width of room 1 read R1y echo Enter the length of room 1 read R2x echo Enter the width of room 2 read R2y expr $R1x \* $R1y read R1z expr $R2x \* $R2y read R2z if [ $R1z -ge $R2z] then echo Room 1 is bigger else echo Room 2 is bigger fi