Problem with Script

Hello Folks,

#!/bin/sh

test       # this is a executable file which is in the /bin/ folder. After it executes, it   returns a value.  Depending on the return value the below condition works 

if [ $? -eq 1 ] then
       whiptail --title "Message" --msgbox "       Check failed          " 10 40
      elif [ $? -eq 0 ]
             then whiptail --title "Message " --msgbox "      check  successfull \n " 10 40
      else
       whiptail --title "Message " --msgbox "        Error \n " 10 40
fi

Whenever I run this script, it get the following error message

checklicense.sh: line 21: syntax error near unexpected token `elif'
checklicense.sh: line 21: `      elif [ $? -eq 0 ]  '

I am not able to understand why such a simple condition is giving me error
Please suggest any other better way to do the same.

Thank you.

Syntax wrong:

substitute with this:

#!/bin/sh

date      
rc=$?
echo $?

if [ $rc -eq 1 ]; then
     echo "Failed"
      elif [ $rc -eq 0 ]; then
             echo "passed"
      else
       echo  "dont know"
fi

cheers,
Devaraj Takhellambam

Thank you Devaraj