0

I would like to what is the issue in this script , why this if condition is getting passed i see that HI is printed , but type = A this if condition should not pass

[omega@ctsedgenode 1.1.11-SNAPSHOT_V12]$ type="A"
[omega@ctsedgenode 1.1.11-SNAPSHOT_V12]$  if [[ $type -eq "C" || $type -eq "D" ]]; then  echo 
"HI" ; fi
HI
[omega@ctsedgenode 1.1.11-SNAPSHOT_V12]$
Surender Raja
  • 3,553
  • 8
  • 44
  • 80
  • 1
    `-eq` is for numbers, `=` or `==` is for strings (in bash this includes patterns). – dan Feb 15 '22 at 07:01

1 Answers1

0

Try with this instead:

if [[ $type == "C" || $type == "D" ]]; then  echo "HI" ; fi
Alessandro Argentieri
  • 2,901
  • 3
  • 32
  • 62
Bouquet
  • 16
  • 2