In Bash, what is the simplest way to test if an array contains a certain value?
a=(b c d) if printf '%s\0' "${a[@]}" | grep -Fqxz c then echo 'array “a” contains value “c”' fi
If you prefer you can use equivalent long options:
--fixed-strings --quiet --line-regexp --null-data