Print file and directory permissions in verbose mode.
This commit is contained in:
parent
873a91ce65
commit
f18573e1b4
1 changed files with 7 additions and 7 deletions
|
@ -12,8 +12,8 @@ declare SEARCH_DIRS=
|
|||
declare VERBOSE=0
|
||||
declare PRINT_FILES=0
|
||||
declare PRINT_DIRS=0
|
||||
declare -r FILE_PERMS="! -perm -664"
|
||||
declare -r DIR_PERMS="! -perm 775"
|
||||
declare -r FILE_PERMS=664
|
||||
declare -r DIR_PERMS=775
|
||||
|
||||
|
||||
function print_usage {
|
||||
|
@ -68,20 +68,20 @@ for arg in $@; do
|
|||
done
|
||||
|
||||
echo "# Searching for directories which do not match '$DIR_PERMS' ..."
|
||||
WRONG_DIRS=(`find $SEARCH_DIRS -type d $DIR_PERMS -print`)
|
||||
echo "# Searching for files which do not match '$FILE_PERMS' ..."
|
||||
WRONG_FILES=(`find $SEARCH_DIRS -type f $FILE_PERMS -print`)
|
||||
WRONG_DIRS=(`find $SEARCH_DIRS -type d ! -perm $DIR_PERMS -print`)
|
||||
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
|
||||
echo "# ** directories with wrong permissions:"
|
||||
for dir in ${WRONG_DIRS[@]}; do
|
||||
echo $dir
|
||||
echo -e "$dir\t\t$(stat -c "%a" $dir)"
|
||||
done
|
||||
|
||||
echo "# ** files with wrong permissions:"
|
||||
for file in ${WRONG_FILES[@]}; do
|
||||
echo $file
|
||||
echo -e "$file\t\t$(stat -c "%a" $file)"
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue