From ce8f55443ccedc1362abe944d582ed33cd95401d Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Sat, 1 Jan 2011 13:13:13 +0100 Subject: [PATCH] avoid 'unbound variable' error in shell script Signed-off-by: Torsten Werner --- config/debian/common | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/debian/common b/config/debian/common index a42c18ff..f611c19e 100644 --- a/config/debian/common +++ b/config/debian/common @@ -3,11 +3,8 @@ # # Set $PROGRAM to a string to have it added to the output. function log () { - if [ -z "${PROGRAM}" ]; then - echo "$(date +"%b %d %H:%M:%S") $(hostname -s) [$$] $@" - else - echo "$(date +"%b %d %H:%M:%S") $(hostname -s) ${PROGRAM}[$$]: $@" - fi + local prefix=${PROGRAM:-} + echo "$(date +"%b %d %H:%M:%S") $(hostname -s) ${prefix}[$$]: $@" } # log the message using log() but then also send a mail -- 2.39.2