From b7ccfa63cac8e9cbfd3e2cf5173c21f148e2a23e Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Fri, 20 Jun 2008 00:51:12 +0100 Subject: Add In_list function to extract various bits of code that did (or should have done) the same job. --- functions/aliases.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/functions/aliases.sh b/functions/aliases.sh index 031dc0e..c4e0290 100755 --- a/functions/aliases.sh +++ b/functions/aliases.sh @@ -16,3 +16,22 @@ Truncate () : > ${FILE} done } + +In_list () +{ + NEEDLES="${1}" + shift + + for ITEM in ${@} + do + for NEEDLE in ${NEEDLES} + do + if [ "${NEEDLE}" = "${ITEM}" ] + then + return 0 + fi + done + done + + return 1 +} -- cgit v1.0