8: Syntax error: word unexpected (expecting ")")

The following code:

weekday=$(date +%a)
day=$(date +%d)
month=$(date +%m)    

if [[ ( $month == 03 || $month == 10 ) && $weekday = "Sun" && $day > 24 ]]
    then
      # DO SOMETHING
      exit 1
    else
      # DO SOMETHING
    fi

leads to the error:

 8: Syntax error: word unexpected (expecting ")")

when executing with:

/bin/sh script.sh

What is wrong here and how can this be fixed?

I need to use sh how i need to modificate this code to get working with sh?


weekday=$(date +%a)
day=$(date +%d)
month=$(date +%m)

if [ \( \( $month -eq 03 \) -o \( $month -eq 10 \) \) -a \( "$weekday" = "Sun" \) -a \( $day -gt 24 \) ]
then
  # DO SOMETHING
  echo ok
else
  # DO SOMETHING
  echo ko
fi

The correct way is:

weekday=$(date +%a)
day=$(date +%d)
month=$(date +%m)

if { [ $month -eq 03 ] || [ $month -eq 10 ]; } && [ $weekday = "So" ] && [ $day -gt 24 ]
then
  echo "true"
else
  echo "false"
fi

VIEW: https://stackoverflow.com/a/66865406/14997935