If you want to mention multiple conditions, just nest them with ( )
:
$ d=23
$ ( [ $d -ge 20 ] && [ $d -ge 5 ] ) || [ $d -ge 5 ] && echo "yes"
yes
However, in this case you may want to use a regular expression as described in Check if a string matches a regex in Bash script:
[[ $aSubj =~ ^(hu|ny)* ]]
This checks if the content in the variable $aSubj
starts with either hu
or ny
.
Or even use the regular expression to fetch the files. For example, the following will match all files in ttt/
directory whose name starts by either a
or b
:
for file in ttt/[ab]*
Note you can also feed your loop with using a process substitution with find
containing a regular expression (samples in How to use regex in file find):
while IFS= read -r file
do
# .... things
done < <(find your_dir -mindepth 1 -maxdepth 1 -type d -regex '.*/\(hu\|ny\).*')
For example, if I have the following dirs:
$ ls dirs/
aa23 aa24 ba24 bc23 ca24
I get this result if I look for directories whose name starts by either ca
or bc
:
$ find dirs -mindepth 1 -maxdepth 1 -type d -regex '.*/\(ca\|bc\).*'
dirs/bc23
dirs/ca24