Add In_list function to extract various bits of code that did (or should have done) the same job.

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
This commit is contained in:
Chris Lamb 2008-06-20 00:51:12 +01:00
parent da4672b5d5
commit 912c054a7e
1 changed files with 19 additions and 0 deletions

View File

@ -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
}