From 3a5484dcd5974b7f7dcdbc8cadd8588f64b15c7e Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 10 Jun 2022 13:50:01 +0200 Subject: [PATCH] system: if no temperature sysctls are exposed do nothing Likely cause for syntax error in user report. PR: https://forum.opnsense.org/index.php?topic=28684.0 --- src/opnsense/scripts/system/temperature.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/opnsense/scripts/system/temperature.sh b/src/opnsense/scripts/system/temperature.sh index e804946b3..bc9e43a0b 100755 --- a/src/opnsense/scripts/system/temperature.sh +++ b/src/opnsense/scripts/system/temperature.sh @@ -42,6 +42,10 @@ if [ "${CMD}" = 'rrd' ]; then done else # The grep is opportunistic, but at least we only grep the - # variable names and not their content at the same time. - sysctl -e $(sysctl -aN | grep temperature) | sort + # variable names and not their content at the same time and + # as long as we can find something that matches our search. + SYSCTLS=$(sysctl -aN | grep temperature) + if [ -n "${SYSCTLS}" ]; then + sysctl -e ${SYSCTLS} | sort + fi fi