From d1317eb08729aa72d6857deac50596b6043125e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Fri, 25 Jan 2019 10:40:51 +0100 Subject: [PATCH] This new version exclude .bak and .date directories. --- evocheck.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 9851b2a..56f5c55 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -857,8 +857,21 @@ if [ -e /etc/debian_version ]; then fi if [ "$IS_OLD_HOME_DIR" = 1 ]; then - find /home/ -maxdepth 1 -type d -nouser | grep -q '^' && echo 'IS_OLD_HOME_DIR FAILED!' - [ "${VERBOSE}" -eq 1 ] && find /home/ -maxdepth 1 -type d -nouser -exec stat -c "%n has owner %u resolved as %U" {} \; + for dir in /home/*; do + statResult=$(stat -c "%n has owner %u resolved as %U" "$dir" \ + | grep -Eve '.bak' -e '\.[0-9]{2}-[0-9]{2}-[0-9]{4}' \ + | grep UNKNOWN) + # There is at least one dir matching + if [[ -n "$statResult" ]]; then + if [[ "$VERBOSE" == 1 ]]; then + echo 'IS_OLD_HOME_DIR FAILED!' + echo "$statResult" + else + echo 'IS_OLD_HOME_DIR FAILED!' + break + fi + fi + done fi fi