[LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection

Petr Vorel pvorel@suse.cz
Wed Apr 16 00:08:45 CEST 2025


Simplify last controller detection by using awk only - replace tail and
pipe with 'END' awk command (works also on Busybox).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index c241a5c4fc..276231fe8d 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -352,7 +352,7 @@ test7()
 		return
 	fi
 
-	subsys=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
+	subsys=$(awk 'END{ print $1 }' /proc/cgroups)
 
 	# remount to add new subsystems to the hierarchy
 	while [ $i -le 2 ]; do
-- 
2.49.0



More information about the ltp mailing list