From f162bc72d0031d5da53352182976f67fcd269775 Mon Sep 17 00:00:00 2001 From: Morgan Aldridge Date: Sun, 1 Jan 2023 09:01:13 -0500 Subject: [PATCH] Avoid non-portable 'pgrep -c' by piping to wc. Issue #344 --- common/profile-sync-daemon.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/profile-sync-daemon.in b/common/profile-sync-daemon.in index 349645d..2761e2e 100644 --- a/common/profile-sync-daemon.in +++ b/common/profile-sync-daemon.in @@ -650,7 +650,7 @@ do_unsync() { parse() { psd_state=$(systemctl --user is-active psd) resync_state=$(systemctl --user is-active psd-resync.timer) - psd_suspend_sync_state=$(pgrep -cf "psd-suspend-sync") + psd_suspend_sync_state=$(pgrep -f "psd-suspend-sync" | wc -l | tr -d ' ') if [[ "$psd_suspend_sync_state" != 0 ]]; then psss_state="enabled" else @@ -756,7 +756,7 @@ take_inhibit_lock() { } release_inhibit_lock() { - [[ "$(pgrep -cf "psd-suspend-sync")" != 0 ]] && pkill -f psd-suspend-sync + [[ "$(pgrep -f "psd-suspend-sync" | wc -l | tr -d ' ')" != 0 ]] && pkill -f psd-suspend-sync } case "$1" in