From 192819684094ea2662a7dde65f6a8f0ec302fbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3mas=20Edwardsson?= Date: Thu, 4 Mar 2010 14:33:22 +0000 Subject: [PATCH] Added support for more than 9 arguments to crit2warn wrapper --- crit2warn.sh/trunk/crit2warn.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crit2warn.sh/trunk/crit2warn.sh b/crit2warn.sh/trunk/crit2warn.sh index 8e00e28..280d0d2 100644 --- a/crit2warn.sh/trunk/crit2warn.sh +++ b/crit2warn.sh/trunk/crit2warn.sh @@ -17,17 +17,16 @@ # crit2warn.sh is a wrapper for Nagios checks that changes the return # code for checks from CRITICAL to WARNING - CMD="" # Quote arguments -for (( i = 1; i < $# ; i++ )); do - eval ARG=\$$i +while (( "$#" > 0 )); do + ARG=$1 + shift CMD="$CMD $(echo "$ARG" | awk '{gsub(".", "\\\\&");print}')" done # Run command -eval "echo $CMD >> /tmp/cmd" eval "$CMD" ret=$?