my_array=("apple" "banana" "cherry")
search_string="banana"

# 使用grep查找,注意需要转换数组为一行一个元素的形式
if printf "%s\n" "${my_array[@]}" | grep -qFx "$search_string"; then
    echo "$search_string was found in the array."
else
    echo "$search_string was not found in the array."
fi