summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-08-22 16:00:40 +0200
committerThomas Bächler <thomas@archlinux.org>2009-08-22 16:00:40 +0200
commit8694cdf8e252c7b443dfb6423a0c6127d9a8c62e (patch)
treee348498b162cb5d699489e6ecc970741be14f499 /functions
parent9137d056806a4947a4da7ae042c48845c18e711a (diff)
Fix in_array function2009.08-1
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.
Diffstat (limited to 'functions')
-rw-r--r--functions2
1 files changed, 1 insertions, 1 deletions
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