about summary refs log tree commit diff stats
path: root/bash/functions.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/functions.bash')
-rw-r--r--bash/functions.bash11
1 files changed, 11 insertions, 0 deletions
diff --git a/bash/functions.bash b/bash/functions.bash new file mode 100644 index 0000000..058e0f9 --- /dev/null +++ b/bash/functions.bash
@@ -0,0 +1,11 @@
1memq() { # memq ITEM ARRAY
2 # Test whether an ITEM is a member of ARRAY.
3 # Pass ARRAY as ${ARRAY[@]}.
4 local e needle="$1"; shift
5 for e; do
6 [[ "$e" == "$needle" ]] && {
7 return 0
8 }
9 done
10 return 1
11}