Numeric Adventures

Bugs Exploring Numerical Quirks:


This buggy Bash script takes a number input from the user and checks if it is greater than, less than, or equal to 10, and also if it is between 0 and 100. However, there are a few bugs in the script:

  1. If the user enters a non-numeric input (e.g., a string), the script will throw an error when trying to compare the input with a number. Add a check to make sure the input is numeric before performing the comparisons.
  2. If the user enters a negative number, the script will incorrectly report that the number is less than 10. Add a check to handle negative numbers.
  3. If the user enters a number greater than or equal to 100, the script will incorrectly report that the number is not between 0 and 100. Add a check to handle numbers greater than or equal to 100.

I hope this helps you practice your debugging skills in Bash!