blob: e2c2c7830861fa1134413d2fada9b65b04a56ced (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/bin/bash
# elementIn checks whether a element is in an array.
#
# Args:
# $1: The element
# $2: The array
#
# Returns:
# 0 if the element is in the array; 1 otherwise.
function elementIn() {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
|