From 8694cdf8e252c7b443dfb6423a0c6127d9a8c62e Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sat, 22 Aug 2009 16:00:40 +0200 Subject: Fix in_array function In in_array a check might look like [ "!" = "@" ], which will fail because of the !, so make this check look like [ "x!" = "x@" ]. Also, when an entry is prefixed with !, it should be handled as if it was not in the array. --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 0f333d4..8745a38 100644 --- a/functions +++ b/functions @@ -164,7 +164,7 @@ in_array() { local item for item in "$@"; do local c="${item:0:1}" - if [ "$c" == "!" -o "$c" == "@" ]; then + if [ "x$c" = "x@" ]; then item="${item:1}" fi [ "$item" = "$needle" ] && return 0 # Found -- cgit v1.2.3-54-g00ecf