#!/bin/bash
#
clear
#
source /usr/local/bin/cores
#
IFS=$(echo -en "\n\b")
#
export CB="${bbra}$(pwd)/"
ti="${bazu}Diretorios"
ts=2
#
shopt -s dotglob  # Enable hidden files in wildcards
#
for tp in "l,d,b,c" "f"; do
    msg "${bcia}Mostrando as Permissões dos ${bbra}'${ti}${bbra}'${cfim}"
    find -L * -maxdepth 0 -type ${tp} -exec bash -c 'file="{}"; \
    chmv=$(stat -c %a "${file}"); \
    [[ ${chmv} == @(400|440|444|464|466) ]] && tc="\e[0;35m"; \
    [[ ${chmv} == @(600|640|644|660|664|666) ]] && tc="\e[0;33m"; \
    [[ ${chmv} == @(700|750|755|775|777) ]] && tc="\e[1;32m"; \
    echo -e "${CB}${file} --> ${tc}chmod=${chmv}${cfim}"' \;
    sleep ${ts};ti="${bama}Arquivos";ts=0
done
#
shopt -u dotglob  # Re-disable it afterward to restore defaults
unset CB
#
