diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2025-06-03 23:07:40 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2025-06-03 23:07:40 -0400 |
| commit | 4eaf7c3908c4fb053ede3ba6e5b788075254c12f (patch) | |
| tree | 29713897dcb124fb587eca940632d0a29cf5148b /tools/lib.sh | |
| parent | Add improvements to db.sh helper script (diff) | |
| download | cli-4eaf7c3908c4fb053ede3ba6e5b788075254c12f.zip | |
Tidy up the test.sh tool script
Diffstat (limited to 'tools/lib.sh')
| -rw-r--r-- | tools/lib.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/lib.sh b/tools/lib.sh new file mode 100644 index 0000000..e2c2c78 --- /dev/null +++ b/tools/lib.sh @@ -0,0 +1,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 +} |