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,377
  • 7
  • 37
  • 68
  • 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
Alex Mawashi
  • 2,303
  • 3
  • 25
  • 51
Bouquet
  • 16
  • 2