functions.sh: add list_contains function for checking whether a list contains a speci...
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 30 Jul 2008 22:39:43 +0000 (22:39 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 30 Jul 2008 22:39:43 +0000 (22:39 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12025 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/base-files/files/etc/functions.sh

index f4af4a8..01db77c 100755 (executable)
@@ -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"
This page took 0.027073 seconds and 4 git commands to generate.