diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-30 20:35:22 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-07-30 20:35:22 +0000 |
commit | 097b27145d8b0e148636abd74ff80b8b92e25c05 (patch) | |
tree | f0afbed2a880bf5748e168039f333cae726ab455 /package/base-files/files | |
parent | 55abede5184d4cc26eb1fb40e2d1dce07814f2a2 (diff) |
functions.sh: add a function for removing an item from a list in a shell variable
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12024 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-x | package/base-files/files/etc/functions.sh | 14 |
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 af4eae23f..f4af4a857 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 "$@" |