📌  相关文章
📜  检查值是否在 bash 数组中 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:06.337000             🧑  作者: Mango

代码示例1
if [[ " ${array[*]} " =~ " ${value} " ]]; then
    # whatever you want to do when array contains value
fi

if [[ ! " ${array[*]} " =~ " ${value} " ]]; then
    # whatever you want to do when array doesn't contain value
fi