From 912c054a7ef3cd0f0e5a113a74f3588febaee297 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. Signed-off-by: Chris Lamb --- functions/aliases.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'functions') diff --git a/functions/aliases.sh b/functions/aliases.sh index 031dc0e77..c4e029038 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.2.3