script o/p problem

#!/bin/bash
string=$1
if [ $string=red ]; then
echo "blue"
elif [ $string=blue ]; then
echo "red"
else
echo "nocolour"
fi

in the above script if I run

red script.sh 

i am getting blue
if I run

blue script.sh

it is showing the following error

File "script.sh", line 2
  string=$1
           ^
SyntaxError: invalid syntax

pls solve my problem
if i run blue script.sh i have to get red
if i run something script.sh i have to get noclour

Hi,

you should run it like that:

./script.sh red

or 

./script.sh blue

correction below

Even you can try this

bash script.sh red

or

bash script.sh blue

sorry that's not the only error.You should also change it like that:

#! /bin/bash

string=$1
if [ "$string" = "red" ]; then
echo "blue"
elif [ "$string" = "blue" ]; then
echo "red"
else
echo "nocolour"
fi