catching some errors

I need to find a way to keep a running tally of how many times events or actions occur. Say if a user is prompted to make inputs of 1 or 2, I want it to keep track of how many times 1 was entered, and how many times 2 was entered.

Thanks for your help

so have you written anything..?

yes sir, i have it written until the end where i want it to display the results of how well the user did. now i need to go back through and take care of those possiable errors

Post the code you've written so far and we'll point you in the right direction. We will -NOT- however do your entire homework assignment.

I have all of the other errors fixed, but i still need to check that runny tally thing.

Can you use ksh instead of sh? If so, you can easily test the answers with something like:

#!/bin/ksh

...possible code...

# Declare inputs as integers
integer n1=0 n2=0

...possible code...

# Take n1 input
until (( $n1 > 0 && $n1 < 21 )); do
  print -n "Please enter a positive integer between 1 and 20: "; read n1
  if (( $n1 < 0 || $n1 > 20 )); then
    print "$n1 is out of range."
  fi
done

# Take n2 input
until (( $n2 > 0 && $n2 < 21 )); do
  print -n "Please enter another positive integer between 1 and 20: "; read n2
  if (( $n2 < 0 || $n2 > 20 )); then
    print "$n2 is out of range."
  fi
done

If you want to display results and quit when the user hits Ctrl-C, you'll need to trap that signal. The syntax is

trap command signal1 signal2 ...

In your case, the signal would be INT.