# Script doesn't understand if conditiojn with or

**URL:** <https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442>\
**Category:** Shell Programming and Scripting\
**Created:** [March 7, 2017, 10:03am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442 "2017-03-07T10:03:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![digioleg54](https://community.unix.com/letter_avatar/digioleg54/32/6_449c533f586939b6e5f246632a46421f.png) [@digioleg54](https://community.unix.com/u/digioleg54)\
**Post date:** [March 7, 2017, 10:03am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/1 "2017-03-07T10:03:55Z")

</div>

I Bourne shell I have a lines

```nohighlight
 #!/bin/sh
 something
 for file in *_${Today}*.csv *_${Today}*.txt
 do
  if [ -f "LET_daily_trans_${Today}.csv" || -f "LET_daily_trans_345_${Tod
ay}.csv" ]
  then
                echo "This file will be processed in separate script"
                continue
  fi
something
 done
 

```

The script doesn't understand if condition. Could you please let me know what is wrong?

Thanks for contribution

---

<div class="post-metadata">

**Author:** ![rdrtx1](https://community.unix.com/user_avatar/community.unix.com/rdrtx1/32/2721_2.png) [@rdrtx1](https://community.unix.com/u/rdrtx1)\
**Post date:** [March 7, 2017, 10:10am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/2 "2017-03-07T10:10:10Z")

</div>

```nohighlight
if [-f "LET_daily_trans_${Today}.csv"] || [-f "LET_daily_trans_345_${Today}.csv"]

```

---

<div class="post-metadata">

**Author:** ![digioleg54](https://community.unix.com/letter_avatar/digioleg54/32/6_449c533f586939b6e5f246632a46421f.png) [@digioleg54](https://community.unix.com/u/digioleg54)\
**Post date:** [March 7, 2017, 10:42am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/3 "2017-03-07T10:42:08Z")

</div>

When I put it this way

```nohighlight
 if [-f "LET_daily_trans_${Today}.csv"] || [-f "LET_daily_trans_345_${Today}.csv"]
 

```

if check this condition for all my files, which doesn't have LET in the name

---

<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:** [March 7, 2017, 10:52am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/4 "2017-03-07T10:52:39Z")

</div>

PLEASE get used to the habit of posting DATA, CONTEXT, ERROR messages, etc. so people can understand and/or analyse WHAT goes wrong.

Your statement is difficult to understand and believe. As long as there is a (any) file named `LET_daily_trans_${Today}.csv` or `LET_daily_trans_345_${Today}.csv` , with `Today` having a matching contents, the condition is true irrerspective of any other file name that you might work upon.

---

<div class="post-metadata">

**Author:** ![rdrtx1](https://community.unix.com/user_avatar/community.unix.com/rdrtx1/32/2721_2.png) [@rdrtx1](https://community.unix.com/u/rdrtx1)\
**Post date:** [March 7, 2017, 10:56am UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/5 "2017-03-07T10:56:21Z")

</div>

```nohighlight
if ["$file" = "LET_daily_trans_${Today}.csv"] || ["$file" = "LET_daily_trans_345_${Today}.csv"]

```

---

<div class="post-metadata">

**Author:** ![Scrutinizer](https://community.unix.com/user_avatar/community.unix.com/scrutinizer/32/1216_2.png) [@Scrutinizer](https://community.unix.com/u/Scrutinizer)\
**Post date:** [March 7, 2017, 11:12pm UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/7 "2017-03-07T23:12:56Z")

</div>

@Don, the use of double `==` in a test command is not part of the POSIX standards. rdrtx1's suggestion is grammatically correct.

See [test: operands](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_05)

---

<div class="post-metadata">

**Author:** ![Don\_Cragun](https://community.unix.com/user_avatar/community.unix.com/don_cragun/32/2682_2.png) [@Don\_Cragun](https://community.unix.com/u/Don_Cragun)\
**Post date:** [March 7, 2017, 11:44pm UTC](https://community.unix.com/t/script-doesnt-understand-if-conditiojn-with-or/365442/8 "2017-03-07T23:44:14Z")

</div>

> [@scrutinizer](#):
>
> @Don, the use of double `==` in a test command is not part of the POSIX standards. rdrtx1's suggestion is grammatically correct.
> 
> See [test: operands](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_05)

Hi Scrutinizer,  
Yes, you are absolutely correct. I have deleted my post with the incorrect suggestion.

Sorry,  
Don
