This question is a sequel of sorts to my earlier question.  The users on this site kindly helped me determine how to write a bash for loop that iterates over string values.  For example, suppose that a loop control variable fname iterates over the strings a.txt b.txt c.txt.  I would like to echo yes! when fname has the value a.txt or c.txt, and echo no! otherwise.  I have tried the following bash shell script:#!/bin/bashfor fname in a.txt b.txt c.txtdo echo $fname if [ $fname = a.txt ] | [ $fname = c.txt ]; then echo yes!else echo no!fidoneI obtain the output:a.txtno!b.txtno!c.txtyes!Why does the if statement apparently yield true when fname has the value a.txt?  Have I used | incorrectly?
In a bash script, using the conditional or in an if statement
bash;shell script
If you want to say OR use double pipe (||).if [ $fname = a.txt ] || [ $fname = c.txt ](The original OP code using | was simply piping the output of the left side to the right side, in the same way any ordinary pipe works.)