From 9e0300b9f28412c98c97521907ca07db9fa5d813 Mon Sep 17 00:00:00 2001
From: Douglas Raillard <douglas.raillard@arm.com>
Date: Tue, 4 Apr 2023 10:39:25 +0100
Subject: [PATCH] shutils: Fix broken redirections

Redirecting all output to /dev/null needs >/dev/null 2>&1 .

Fix cases where 2>&1 /dev/null was used, and also remove &> that is not
POSIX.
---
 devlib/bin/scripts/shutils.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/devlib/bin/scripts/shutils.in b/devlib/bin/scripts/shutils.in
index 458c97f..6607504 100755
--- a/devlib/bin/scripts/shutils.in
+++ b/devlib/bin/scripts/shutils.in
@@ -161,7 +161,7 @@ cgroups_run_into() {
 
 	  # Check if the required CGroup exists
 	  $FIND $CGMOUNT -type d -mindepth 1 | \
-	  $GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP" &>/dev/null
+	  $GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP" >/dev/null 2>&1
 	  if [ $? -ne 0 ]; then
 		echo "ERROR: could not find any $CGP cgroup under $CGMOUNT"
 		exit 1
@@ -345,7 +345,7 @@ _command_not_found() {
     exit 1
 }
 # Check the command exists
-type "$CMD" 2>&1 >/dev/null || _command_not_found
+type "$CMD" >/dev/null 2>&1 || _command_not_found
 
 "$CMD" "$@"