# Why does this if match although it shouldn't?

**URL:** <https://community.unix.com/t/why-does-this-if-match-although-it-shouldnt/371060>\
**Category:** Shell Programming and Scripting\
**Created:** [February 23, 2018, 6:55am UTC](https://community.unix.com/t/why-does-this-if-match-although-it-shouldnt/371060 "2018-02-23T06:55:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![h1kelds](https://community.unix.com/letter_avatar/h1kelds/32/6_449c533f586939b6e5f246632a46421f.png) [@h1kelds](https://community.unix.com/u/h1kelds)\
**Post date:** [February 23, 2018, 6:55am UTC](https://community.unix.com/t/why-does-this-if-match-although-it-shouldnt/371060/1 "2018-02-23T06:55:12Z")

</div>

Hi everyboy,

I am a little confused and can't understand why I get a positive match in the following case.

Shell Script section

```nohighlight
echo $SHELL
echo "Server type = ${SERV_TYPE}"
if [["${SERV_TYPE}" == ["sapapp+oradb" || "sapapp"] ]]; then
    echo "foor"
    echo -e $(_date) "${cinfo}INFO: ${crst}Checking SAP memory on ${HOST}"

```

This is the output

```nohighlight
/bin/bash
Server type = hanadb
foor
2018-02-23 12:21:41 INFO: Checking SAP memory on test0815

```

My need is that the if statement checks variable SERV\_TYPE and exactly matches "sapapp+oradb" or "sapapp". So that in my example this should not match, but somehow it does 😕

Could anyone please help me to understand what is going on here and what I have done wrong?

Kind Regards,  
h1kelds

---

<div class="post-metadata">

**Author:** ![RudiC](https://community.unix.com/letter_avatar/rudic/32/6_449c533f586939b6e5f246632a46421f.png) [@RudiC](https://community.unix.com/u/RudiC)\
**Post date:** [February 23, 2018, 7:30am UTC](https://community.unix.com/t/why-does-this-if-match-although-it-shouldnt/371060/2 "2018-02-23T07:30:41Z")

</div>

Methinks you want to use

```nohighlight
if [["${SERV_TYPE}" == "sapapp+oradb" || "${SERV_TYPE}" == "sapapp"]]; then

```
