From b589528e03d262362d22995f1b3d65e6d4cc95ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 20 Feb 2020 15:35:33 +0100 Subject: [PATCH] Fix individual redirection with { cmd1; cmd2; } MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consider using { cmd1; cmd2; } >> file instead of individual redirects. See : https://github.com/koalaman/shellcheck/wiki/SC2129 --- xymon/plugins/client/ext/smart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xymon/plugins/client/ext/smart b/xymon/plugins/client/ext/smart index 85a6000..9a186bf 100755 --- a/xymon/plugins/client/ext/smart +++ b/xymon/plugins/client/ext/smart @@ -127,12 +127,14 @@ while IFS= read -r LINE; do echo "${COLOR} $DISK ${TYPE}" - echo "${COLOR} $DISK ${TYPE}" | cut -c2- >>/tmp/dres - echo "" >>/tmp/dres - echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^===" >>/tmp/dres - echo "------------------------------------------------------------" >>/tmp/dres - echo "" >>/tmp/dres - echo "" >>/tmp/dres + { + echo "${COLOR} $DISK ${TYPE}" | cut -c2- + echo "" + echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^===" + echo "------------------------------------------------------------" + echo "" + echo "" + } >>/tmp/dres done < /tmp/dscan >/tmp/dcheck # Set the global color according to the highest alert