The total number of supplied command-line arguments is hold by a in bash's internal variable $#. Consider a following example of simple bash script which will print out a total number of supplied command-line arguments to the STDOUT:

#!/bin/bash
echo $#

Save the file as args.sh and execute it as follows:

$ bash args.sh  a b c d e 
4

The example above shows us that the four arguments separated by space are passed to the args.sh script. The number of arguments received by the script is stored in the internal variable $#

Make sure that script has received the correct number of arguments.

It is always good or even required that if a script receives arguments then we should ensure that the script receives that correct number. This can be done as follows:

#!/bin/bash
if [ "$#" -ne 2 ]; then
    echo "You must enter exactly 2 command line arguments"
    exit 1
fi

Easy Peasy.