From 1aad813663fbaa96cb23c106fb5d8d8ea8591425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Tue, 12 Feb 2019 12:38:11 +0100 Subject: [PATCH] IS_BACKPORTSCONF: Quiet grep and better readability Added `-s` to grep to not have error messages like: `grep: /etc/apt/preferences.d/*: No such file or directory` And don't use `2>/dev/null` as there is `-s` grep option! Added if condition for better readability of the code. --- evocheck.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 4364a2a..cefeb03 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -607,8 +607,12 @@ if [ -e /etc/debian_version ]; then if [ "$IS_BACKPORTSCONF" = 1 ]; then if is_debianversion stretch; then - grep -qE "^[^#].*backports" /etc/apt/sources.list && echo 'IS_BACKPORTSCONF FAILED!' - grep -qE "^[^#].*backports" /etc/apt/sources.list.d/*.list 2>/dev/null && (grep -qE "^[^#].*backports" /etc/apt/preferences.d/* || echo 'IS_BACKPORTSCONF FAILED!') + grep -qsE "^[^#].*backports" /etc/apt/sources.list \ + && echo 'IS_BACKPORTSCONF FAILED!' + if grep -qsE "^[^#].*backports" /etc/apt/sources.list.d/*.list; then + grep -qsE "^[^#].*backports" /etc/apt/preferences.d/* \ + || echo 'IS_BACKPORTSCONF FAILED!' + fi fi fi