Skip to main content
deleted 55 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

This code generates a error line 3: [: missing `]'. So please anyone tell me that why i am I getting such error.I am new in bash scripting.?

#!/bin/bash
read x
if [ $x == "Y" ] || [ $x == "y"]
then
   echo "YES"
else
   echo "NO"
fi

Thanks in advance.

This code generates a error line 3: [: missing `]'. So please anyone tell me that why i am getting such error.I am new in bash scripting.

#!/bin/bash
read x
if [ $x == "Y" ] || [ $x == "y"]
then
   echo "YES"
else
   echo "NO"
fi

Thanks in advance.

This code generates a error line 3: [: missing `]'. So why am I getting such error?

#!/bin/bash
read x
if [ $x == "Y" ] || [ $x == "y"]
then
   echo "YES"
else
   echo "NO"
fi

Thanks in advance.

Source Link
Rajat Garg
  • 373
  • 1
  • 3
  • 5

OR operator in bash scripting

This code generates a error line 3: [: missing `]'. So please anyone tell me that why i am getting such error.I am new in bash scripting.

#!/bin/bash
read x
if [ $x == "Y" ] || [ $x == "y"]
then
   echo "YES"
else
   echo "NO"
fi

Thanks in advance.