From 326fc006a328ce46caf92329a750b22f2b40f9e3 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Thu, 5 Jul 2012 07:41:51 +0000 Subject: [PATCH] New parameter to suppress the list of file/directory with wrong permissions. --- check_permissions.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/check_permissions.sh b/check_permissions.sh index 82a1d3d..fe9ee19 100755 --- a/check_permissions.sh +++ b/check_permissions.sh @@ -71,6 +71,12 @@ for arg in $@; do PRINT_FILES=1 PRINT_DIRS=1 ;; + --no-print-files) + PRINT_FILES=0 + ;; + --no-print-dirs) + PRINT_DIRS=0 + ;; *) if [[ ! -d $arg ]]; then echo "# Skipped $arg" @@ -88,7 +94,7 @@ echo "# Searching for files which do not match at least '$FILE_PERMS' ..." WRONG_FILES=(`find $SEARCH_DIRS -type f ! -perm -$FILE_PERMS -print`) -if [[ $PRINT_FILES -eq 1 ]]; then +if [[ $PRINT_DIRS -eq 1 ]]; then echo "# ** directories with wrong permissions:" for dir in ${WRONG_DIRS[@]}; do if [[ $FIX_PERMISSIONS -eq 1 ]]; then @@ -103,7 +109,9 @@ for dir in ${WRONG_DIRS[@]}; do echo -e "$dir\t\t$(stat -c "%a" $dir)" fi done +fi +if [[ $PRINT_FILES -eq 1 ]]; then echo "# ** files with wrong permissions:" for file in ${WRONG_FILES[@]}; do if [[ $FIX_PERMISSIONS -eq 1 ]]; then