Skip to main content
added 100 characters in body
Source Link
PersianGulf
  • 11.3k
  • 11
  • 56
  • 83

You have to use double brace and enclose your variables with "":

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

However i prefer to use:

echo $x |tr '[A-Z]' '[a-z]' 

It's very better than if-statement.

You have to use double brace and enclose your variables with "":

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

You have to use double brace and enclose your variables with "":

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

However i prefer to use:

echo $x |tr '[A-Z]' '[a-z]' 

It's very better than if-statement.

Source Link
PersianGulf
  • 11.3k
  • 11
  • 56
  • 83

You have to use double brace and enclose your variables with "":

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