Shell script executing both the conditions.

I have written this script. This is used for creating a backup folder.

#!/bin/sh
#set -x
. /home/.profile
usage="Usage is $0"
usage="$usage [-b <dir>]"
# Use the getopt utility to set up the command line flags.
set -- `/usr/bin/getopt b: $*`
# Process individual command line arguments
while [ $1 != -- ]; do
  case $1 in
    -b)  dir=$2
         shift
         ;;
    esac
  shift
done
MYSQLBACKUP=`which mysqlbackup`
if [ "$backup_dir" == "" ];then
datedir=`date +"%Y%m%d"`
backupdir=/home/back
$MYSQLBACKUP --defaults-file=$INSTANCE_HOME/my.cnf --backup-dir=$backupdir/$datedir --compress backup
if [ $? -eq 0 ]; then
   start_lsn=`grep -E 'start_lsn' variables.txt`
   end_lsn=`grep -E 'end_lsn' variables.txt`
         exit 1
else
   echo " [`date +%Y\-%m\-%d\ %H\:%M\:%S`] [ERROR] Backup Failed. Please check"
   echo "backup failed." |mailx -s "full backup failed." abc.com 
fi
fi
 

The problem is that even when the command is executing without any error it is pring the commands in the success block (when if is true) but it is also printing the commands in the unsuccessfull block (else condition) too.
any suggestions?:confused:

Since the user cummulated enough Infraction point to be banned automaticaly by the system, I see no reason to leave this thread open, so I am closing it...