summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-15 15:59:56 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-15 15:59:56 +0000
commitdc98b646744a8983e57d926a863777a322ebe2ba (patch)
tree4896183e0a0c36395912d5e066209687bdce472b
parent31cf56048402561caa5a5d70ef40c8fefefb69f0 (diff)
some shell variable handling fixes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7638 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/base-files/files/etc/functions.sh6
-rw-r--r--package/base-files/files/lib/config/uci.sh2
2 files changed, 4 insertions, 4 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index 7ba59afbb..8d1117163 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -55,7 +55,7 @@ config_rename() {
local oldvar
local newvar
- [ "$OLD" -a "$NEW" ] || return
+ [ -n "$OLD" -a -n "$NEW" ] || return
for oldvar in `set | grep ^CONFIG_${OLD}_ | \
sed -e 's/\(.*\)=.*$/\1/'` ; do
newvar="CONFIG_${NEW}_${oldvar##CONFIG_${OLD}_}"
@@ -139,7 +139,7 @@ config_foreach() {
[ -z "$CONFIG_SECTIONS" ] && return 0
for section in ${CONFIG_SECTIONS}; do
config_get cfgtype "$section" TYPE
- [ -n "$type" -a "$cfgtype" != "$type" ] && continue
+ [ -n "$type" -a "x$cfgtype" != "x$type" ] && continue
eval "$function \"\$section\""
done
}
@@ -186,7 +186,7 @@ strtok() { # <string> { <variable> [<separator>] ... }
shift 2
done
- if [ $# -gt 0 -a "$val" ]; then
+ if [ $# -gt 0 -a -n "$val" ]; then
export ${NO_EXPORT:+-n} "$1=$val"; count=$((count+1))
fi
diff --git a/package/base-files/files/lib/config/uci.sh b/package/base-files/files/lib/config/uci.sh
index da6ecab51..a53938835 100644
--- a/package/base-files/files/lib/config/uci.sh
+++ b/package/base-files/files/lib/config/uci.sh
@@ -90,7 +90,7 @@ uci_set() {
( # spawn a subshell so you don't mess up the current environment
uci_load "$PACKAGE"
config_get OLDVAL "$CONFIG" "$OPTION"
- if [ "$OLDVAL" != "$VALUE" ]; then
+ if [ "x$OLDVAL" != "x$VALUE" ]; then
config_get type "$CONFIG" TYPE
[ -z "$type" ]
fi