Random Project

made it compatible with standard sh

I made it compatible with POSIX-conformant sh.
Is any license condition on redistributing the modified code?
The change set as follows.

— check_cpu_stats.orig 2014-02-06 11:28:47.000000000 +0900
+++ check_cpu_stats 2014-02-06 11:29:59.509817215 +0900
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
# ==============================================================================
# CPU Utilization Statistics plugin for Nagios
#
@@ -163,7 +163,7 @@

# List to Table for warning threshold (compatibility with
-set +A TAB_WARNING_THRESHOLD `echo $LIST_WARNING_THRESHOLD | sed ‘s/,/ /g’`
+TAB_WARNING_THRESHOLD=( `echo $LIST_WARNING_THRESHOLD | sed ‘s/,/ /g’` )
if [ “${#TAB_WARNING_THRESHOLD[@]}” -ne “3” ]; then
echo “ERROR : Bad count parameter in Warning Threshold”
exit $STATE_WARNING
@@ -174,7 +174,7 @@
fi

# List to Table for critical threshold
-set +A TAB_CRITICAL_THRESHOLD `echo $LIST_CRITICAL_THRESHOLD | sed ‘s/,/ /g’`
+TAB_CRITICAL_THRESHOLD=( `echo $LIST_CRITICAL_THRESHOLD | sed ‘s/,/ /g’` )
if [ “${#TAB_CRITICAL_THRESHOLD[@]}” -ne “3” ]; then
echo “ERROR : Bad count parameter in CRITICAL Threshold”
exit $STATE_WARNING