From a079f4f2b3607ae4fcfe72dba913d6589fa35f4c Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 2 Jul 2011 16:43:58 -0400 Subject: functions: remove cruft from in_array the for loop is already a NOOP when the haystack is empty, so it already falls through to the return 1. Signed-off-by: Dave Reisner --- functions | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/functions b/functions index ac7da7e..ffb00ec 100644 --- a/functions +++ b/functions @@ -46,9 +46,8 @@ in_array() { # $1: needle # ${@:2}: haystack - local needle=$1; shift - [[ -z $1 ]] && return 1 # Not Found - local item + local item= needle=$1; shift + for item in "$@"; do [[ $item = $needle ]] && return 0 # Found done -- cgit v1.2.3-24-g4f1b