about summary refs log tree commit diff stats
path: root/bash/functions.bash
blob: 058e0f9eb984113e622e55cb05bfd6f6b3c521f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
memq() { # memq ITEM ARRAY
    # Test whether an ITEM is a member of ARRAY.
    # Pass ARRAY as ${ARRAY[@]}.
    local e needle="$1"; shift
    for e; do
        [[ "$e" == "$needle" ]] && {
            return 0
        }
    done
    return 1
}