]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
use grep whole-word search
authorMatteo Croce <teknoraver@meta.com>
Fri, 4 Apr 2025 16:16:08 +0000 (18:16 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 4 Apr 2025 20:24:30 +0000 (05:24 +0900)
grep supports whole-word search with `-w`, no need to look for a
trailing space.

test/units/TEST-35-LOGIN.sh

index b19f42b524dfa8baf8d9670df4a6380f1b86df09..9620bbad6fede159a49de27a9912f4c89873a91c 100755 (executable)
@@ -765,19 +765,19 @@ EOF
 
     # Now check that run0's session class control works
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT0" sleep infinity
-    loginctl | grep lightuser | grep -q "background-light "
+    loginctl | grep lightuser | grep -qw background-light
     systemctl stop "$RUN0UNIT0"
 
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT1" --lightweight=yes sleep infinity
-    loginctl | grep lightuser | grep -q "background-light "
+    loginctl | grep lightuser | grep -qw background-light
     systemctl stop "$RUN0UNIT1"
 
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT2" --lightweight=no sleep infinity
-    loginctl | grep lightuser | grep -q "background "
+    loginctl | grep lightuser | grep -qw background
     systemctl stop "$RUN0UNIT2"
 
     systemd-run --service-type=notify run0 -u root --unit="$RUN0UNIT3" sleep infinity
-    loginctl | grep root | grep -q "background-light "
+    loginctl | grep root | grep -qw background-light
     systemctl stop "$RUN0UNIT3"
 }