Verify input parameters

I have to write a script to verify input parameters;
say esr should be YES or NO other wise the script should print an error.
This is what i tried in my script but I get the following error
[YES != YES
./test.sh[83]: [YES: not found.
esr="YES"

if [$esr != "YES" || $esr != "NO"]; then
print " Error should specify esr options YES/NO"
else
esr =$esr
fi

what am i doing wrong can anybody help me.

Thanks,
ram

Basic command line argument input is $1

case $1 in
  YES )
     do something ;;
  NO )
     do something else ;;
  * )
     let the user know they messed up the input ;;
esac

For more advanced options try using the getopts function to seperate command line arguments.

th problme is in:

if [$esr != "YES" || $esr != "NO"];
you need 2space in blank: 1 after [ and the second before ]

O:
if [ $esr != "YES" || $esr != "NO" ];

But you have other problem i f you want to use || the sintax correct is:

if [ $esr != "YES" ] || [ $esr != "NO" ];

other way

if [ $esr != "YES" -o $esr != "NO" ];