Amit Dhamu

Writes Code

Bash - If In Array

ARRAY=(foo bar baz qux)
SEARCH="qux"
NOPE="nope"

if [[ "${ARRAY[@]}" =~ "${SEARCH}" ]]; then
    echo "YES, qux is in the array"
fi

if [[ ! "${ARRAY[@]}" =~ "${NOPE}" ]]; then
    echo "No, nope is NOT in the array"
fi


bash / shell / if

← Bootstrap 4 SCSS Breakpoint Utility Mixins