You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
systemd/SOURCES/0346-test-merge-grep-awk-ca...

44 lines
1.5 KiB

From b13ef318b4f02ad21f0235d22da4e22cb9745cc3 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Sun, 17 Jul 2022 15:41:38 +0200
Subject: [PATCH] test: merge grep | awk calls
(cherry picked from commit 283db37a20900b549508b2bf6d9db898c9a0ca67)
Related: #2100464
---
test/units/testsuite-35.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh
index 28022b03cf..d9eccee84f 100755
--- a/test/units/testsuite-35.sh
+++ b/test/units/testsuite-35.sh
@@ -262,7 +262,7 @@ check_session() (
return 1
fi
- session=$(loginctl --no-legend | grep "logind-test-user" | awk '{ print $1 }')
+ session=$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1 }')
if [[ -z "$session" ]]; then
echo "no session found for user logind-test-user" >&2
return 1
@@ -273,7 +273,7 @@ check_session() (
return 1
fi
- leader_pid=$(loginctl session-status "$session" | grep "Leader:" | awk '{ print $2 }')
+ leader_pid=$(loginctl session-status "$session" | awk '$1 == "Leader:" { print $2 }')
if [[ -z "$leader_pid" ]]; then
echo "cannot found leader process for session $session" >&2
return 1
@@ -353,7 +353,7 @@ EOF
udevadm info "$dev"
# trigger logind and activate session
- loginctl activate "$(loginctl --no-legend | grep "logind-test-user" | awk '{ print $1 }')"
+ loginctl activate "$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1 }')"
# check ACL
sleep 1