I am trying to match on the presence of a word in a list before adding that word again (to avoid duplicates). I am using bash 4.2.24 and am trying the below:
You can use grep, which is more portable than bash's regexp like this:
if echo $foo | grep -q '\'; then echo "MATCH"; else echo "NO MATCH"; fi