From 671bdbd92b030081d422f27384ffacc27e753a1e Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Thu, 17 Jan 2019 11:28:34 +0100 Subject: [PATCH] Rewrite IS_OLD_HOME_DIR with find (fix output order in verbose mode) --- evocheck.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 87567b0..a825350 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -843,14 +843,8 @@ if [ -e /etc/debian_version ]; then fi if [ "$IS_OLD_HOME_DIR" = 1 ]; then - for dir in /home/*; do - stat -c "%n has owner %u resolved as %U" "$dir" | grep -v .bak | grep UNKNOWN | verbose - if [[ ${PIPESTATUS[2]} == 0 ]]; then - # There is at least one dir matching - echo 'IS_OLD_HOME_DIR FAILED!' - break - fi - done + 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" {} \; fi fi