From ca3e0f60d834d1d9fa57440c134a5ca4332ba394 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Tue, 3 Jul 2012 12:18:37 +0200 Subject: Cleanup src/network quirk() is not used anymore, inarray() doesn't belong in src/network. --- src/globals | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/globals') diff --git a/src/globals b/src/globals index 5278bdc..491f9d6 100644 --- a/src/globals +++ b/src/globals @@ -94,6 +94,19 @@ function checkyesno() { esac } +## Check if variable is a member of an array +# $1: the variable to find +# $2...: the array elements +function inarray() { + local item search="$1" + shift + for item in "$@"; do + if [[ "$item" == "$search" ]]; then + return 0 + fi + done + return 1 +} ## Waits until a statement succeeds or a timeout occurs # $1: timeout in seconds -- cgit v1.2.3-24-g4f1b