Use -z and -n in printconf instead of == "" and != ""
authorMatthijs Kooijman <matthijs@stdin.nl>
Fri, 19 Mar 2010 12:08:18 +0000 (13:08 +0100)
committerMatthijs Kooijman <matthijs@stdin.nl>
Fri, 19 Mar 2010 20:40:15 +0000 (21:40 +0100)
This could prevent potential problems when (default) values contain
values special to [, such as -n or -a etc. It seems bash is smart enough
to detect this, but better be safe than sorry.

lib/tools.in

index 9879e741039a5994bd544fd8e60896c9612d6cd5..eeec5900ce567201f8b449eb9096898546d6164c 100644 (file)
@@ -34,7 +34,7 @@ function printconf() {
    local CURRENT_PARAM=$1
    local ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE`
    # if nothing is returned, set the default
-   if [ "$ret" == "" -a "$2" != "" ]; then
+   if [ -z "$ret" -a -n "$2" ]; then
       ret="$2"
    fi