arr_host=("abc" "123" "tom")
find_value="abc"

方法1

res=$(echo "${arr_host[@]}" | grep -wq "${find_value}" &&  echo "yes" || echo "no")

方法2

if [[  "${arr_host[@]}" =~ "${find_value}" ]];then
        echo "have"
else
        echo "no"
fi

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2021-05-26
  • 2022-02-10
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-27
  • 2022-01-17
  • 2022-12-23
  • 2022-02-08
  • 2021-12-10
  • 2021-11-30
  • 2021-08-08
相关资源
相似解决方案