diff options
author | Thomas Bächler <thomas@archlinux.org> | 2009-08-22 16:00:40 +0200 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2009-08-22 16:00:40 +0200 |
commit | 8694cdf8e252c7b443dfb6423a0c6127d9a8c62e (patch) | |
tree | e348498b162cb5d699489e6ecc970741be14f499 | |
parent | 9137d056806a4947a4da7ae042c48845c18e711a (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.
-rw-r--r-- | functions | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 |