From 0fc9d0921e0418e58539e075785dded7cbbe92b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Thu, 21 Mar 2019 23:56:12 +0100 Subject: [PATCH] grep can count occurrences too --- evocheck.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evocheck.sh b/evocheck.sh index 2ed4d2e..30c7e85 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -372,7 +372,8 @@ if is_debian; then fi if [ "$IS_CUSTOMCRONTAB" = 1 ]; then - grep -E "^(17 \*|25 6|47 6|52 6)" /etc/crontab | wc -l | grep -q ^4$ && failed "IS_CUSTOMCRONTAB" + found_lines=$(grep -c -E "^(17 \*|25 6|47 6|52 6)" /etc/crontab) + test "$found_lines" = "4" && failed "IS_CUSTOMCRONTAB" fi if [ "$IS_SSHALLOWUSERS" = 1 ]; then