test-execute: simplify checks if grep output is empty

grep already indicates if it matched anything by return value.
Additional advantage is then that if the test fails, the unexpected
matching lines are visible in the log output.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-03-22 15:57:56 +01:00
parent b1ffacb631
commit c725631f4b
2 changed files with 2 additions and 2 deletions
@@ -2,6 +2,6 @@
Description=Test for CapabilityBoundingSet
[Service]
ExecStart=/bin/sh -x -c 'c=$$(capsh --print | grep "^Bounding set .*cap_chown"); test -z "$$c"'
ExecStart=/bin/sh -x -c '! capsh --print | grep "^Bounding set .*cap_chown"'
Type=oneshot
CapabilityBoundingSet=~CAP_CHOWN
@@ -2,6 +2,6 @@
Description=Test for PrivateNetwork
[Service]
ExecStart=/bin/sh -x -c 'i=$$(ip link | grep ": " | grep -v ": lo:"); test -z "$$i"'
ExecStart=/bin/sh -x -c '! ip link | grep ": " | grep -v ": lo:"'
Type=oneshot
PrivateNetwork=yes