aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-07-30 20:35:22 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-07-30 20:35:22 +0000
commit4d883da9bf1f33a49b7962c44ae2245714edabc7 (patch)
treebef22d5cc185e757c9918b6f6e44ac35731ba9ae /package
parent3380590790df497196fcb32eea09260d624e44bd (diff)
downloadupstream-4d883da9bf1f33a49b7962c44ae2245714edabc7.tar.gz
upstream-4d883da9bf1f33a49b7962c44ae2245714edabc7.tar.bz2
upstream-4d883da9bf1f33a49b7962c44ae2245714edabc7.zip
functions.sh: add a function for removing an item from a list in a shell variable
SVN-Revision: 12024
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/etc/functions.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index af4eae23f5..f4af4a8573 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -24,6 +24,20 @@ append() {
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
}
+list_remove() {
+ local var="$1"
+ local remove="$2"
+ local val
+
+ eval "val=\" \${$var} \""
+ val1="${val%% $remove *}"
+ [ "$val1" = "$val" ] && return
+ val2="${val##* $remove }"
+ [ "$val2" = "$val" ] && return
+ val="${val1## } ${val2%% }"
+ eval "export ${NO_EXPORT:+-n} -- \"$var=\$val\""
+}
+
config_load() {
[ -n "$IPKG_INSTROOT" ] && return 0
uci_load "$@"