redirection if command help please

#!/bin/bash

    clear
    echo "Hello $USER"
    echo "Do you wish to run this network configuration script [Y/N]?"
    read option
    
    
    if($option == 'Y' || 'y' )
    then
                    
        echo " auto eth0
        iface eth0 inet static
        address 192.168.1.161
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.206:7926
        
        auto eth0:1
        iface eth0:1 inet static
        address 146.192.161.112
        netmask 255.255.255.0
        network 146.192.161.0
        broadcast 146.192.161.255
        gateway 146.192.161.254
        
        auto eth0:2
        iface eth0:2 inet static
        address 10.10.121.116
        netmask 255.255.255.0
        network 10.10.121.0
        broadcast 10.10.121.255
        gateway 10.10.121.211:3162 " >> /etc/network/interfaces
    fi
    
    if($option != "Y" || "y")
    then
        echo "Okay! Bye!"
    fi

^^^^^ that is my entire script....all i am attempting is:

IF user input is Y or y then add text to file indicated......else if user option is not Y or y then print message and exit.

I get the following error message after running the script:

Hello administrator
Do you wish to run this network configuration script [Y/N]?
y
./net script2.sh: line 9: y: command not found
./net script2.sh: line 9: y: command not found
./net script2.sh: line 37: y: command not found
./net script2.sh: line 37: y: command not found

this output is given with every input, although the error does change, but, only where it will replace the y with the letter inputted....can anyone help please???

thanks in advance

wez

if syntax is not correct. it should be:

if [[ "$option" = "Y" || "$option" = "y" ]]

and

if [[ "$option" != "Y" && "$option" != "y" ]]

Or:

case "${option}" in
           "Y"|"y")     # Do the task
                            echo " auto eth0
                            .... et cetera ....
                            gateway 10.10.121.211:3162 " >> /etc/network/interfaces
           ;;
           *)            # Exit
           echo "Okay! Bye!"
           ;;
esac

thanks for the replies however none of the fixes work, i am still recieveing the same errors. any other ideas please guys?

thanks again

Please post the entire modified script, the exact command you're executing and the exact output.

Check what comparison operators bash has. is it = or == or eq or -eq. Check the syntax in if line as well.