Hello my teacher gave me an exercise to enter my name and 2 numbers the output must show the sum and the product of these 2 numbers and keep repeating the same procedure using a while loop till i answered "no" to a question if i want to continue,so I wrote this shell code but something is wrong ,I am using Ubuntu and vi editor:
# anyway to improve it and what is wrong? thank you for help.
Code:
#! /bin/bash while : do echo "please enter your name" read name echo"please enter your first number" read firstnumber echo"please enter your second number" read secondnumber echo "sum of the 2 numbers are" expr $firstnumber + $secondnumber echo "product of the 2 numbers is" expr $firstnumber \* $secondnumber echo " do you wish to continue? yes/no" read input if [$input =="no"]; then break fi done
Comment