title: Bash counting Arguments
body: <p>I am having an issue counting the arguments I enter in my shell script. My script is suppose to echo "You have entered too many arguments" by using and Else statement at the end of my code. If I enter more than 3 I get nothing. Am I missing something simple or should I change this to a case statement. I am new to shell scripting so any help would be greatly appreciated.  </p>
  
  <pre><code>#!/bin/bash
  clear
  
  Today=$(date +"%m-%d-%y")
  echo -en '\n'
  echo "To find out more about this calculator please refer to the calc.readme file."
  echo -en '\n'
  echo "You entered $*"
  echo -en '\n'
  if [ "$#" -eq "3" ]; then
  if   [ "$2" == "+" ]; then
      answer=`expr $1 + $3`
      echo "You entered the correct amount of arguments"
      echo -en '\n'
      echo "Your total is: "`expr $1 + $3`
      echo "[$Today]: $@ = $answer"  &gt;&gt; calc.history
  elif [ "$2" == "-" ]; then
      answer=`expr $1 - $3`
      echo "You entered the correct amount of arguments"
      echo -en '\n'
      echo "Your total is: "`expr $1 - $3`
      echo "[$Today]: $@ = $answer" &gt;&gt; calc.history
   elif [ "$2" == "*" ]; then
      answer=`expr $1 \* $3`
      echo "You entered the correct amount of arguments"
      echo -en '\n'
      echo "Your total is: "`expr $1 \* $3`
      echo "[$Today]: $@ = $answer" &gt;&gt; calc.history
   elif [ "$2" == "/" ]; then
      asnwer=`expr $1 / $3`
      echo "You entered the correct amount of arguments"
      echo -en '\n'
      echo "Your total is: "`expr $1 / $3`
      echo "[$Today]: $@ = $answer" &gt;&gt; calc.history
   else
      echo -en '\n'
      echo "You entered too many arguments."
    fi
    fi
  </code></pre>