From: Matthijs Kooijman Date: Fri, 19 Mar 2010 12:08:18 +0000 (+0100) Subject: Use -z and -n in printconf instead of == "" and != "" X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=commitdiff_plain;h=9d7fee1c1978abfeacc86652abdb9de6e0a2a0c4 Use -z and -n in printconf instead of == "" and != "" 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. --- diff --git a/lib/tools.in b/lib/tools.in index 9879e74..eeec590 100644 --- a/lib/tools.in +++ b/lib/tools.in @@ -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