summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-07-30 22:39:43 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-07-30 22:39:43 +0000
commit8c453b693ce2790ab8cd489cb19a90388242e799 (patch)
tree8fb2f0b30432a74e6428d284c88b4aa763ca9cab /package/base-files/files
parent4d883da9bf1f33a49b7962c44ae2245714edabc7 (diff)
downloadmtk-20170518-8c453b693ce2790ab8cd489cb19a90388242e799.zip
mtk-20170518-8c453b693ce2790ab8cd489cb19a90388242e799.tar.gz
mtk-20170518-8c453b693ce2790ab8cd489cb19a90388242e799.tar.bz2
functions.sh: add list_contains function for checking whether a list contains a specific element
SVN-Revision: 12025
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/etc/functions.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index f4af4a8..01db77c 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -24,6 +24,15 @@ append() {
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
+list_contains() {
+ local var="$1"
+ local str="$2"
+ local val
+
+ eval "val=\" \${$var} \""
+ [ "${val%% $str *}" != "$val" ]
+}
+
list_remove() {
local var="$1"
local remove="$2"