function array_contains() { shift local haystack=("${@}") local found=0 for item in "${haystack[@]}"; do if [[ "$item" == "$needle" ]]; then found=1 break fi done if [[ $found -eq 1 ]]; then return 0 # True else return 1 # False fi }