#!/bin/bash
#
. /usr/local/bin/banner || exit 1
#
clear
#
IFS=$(echo -en "\n\b")
#
ti="${bazu}Diretorios"
#
shopt -s dotglob  # Enable hidden files in wildcards
#
chmod_(){
for tp in "l,d,b,c" "f"; do
    msg "${bcia}Mostrando as Permissões dos ${bbra}'${ti}${bbra}'"
    find -L -- * -maxdepth 0 -type ${tp} -exec bash -c 'fd="$1"; \
    chmv=$(stat -c %a" ["%A"]" "${fd}"); \
    [[ ${chmv} == "4"* ]]  && tc="\e[0;35m"; \
    [[ ${chmv} == "6"* ]]  && tc="\e[0;33m"; \
    [[ ${chmv} == "7"* ]]  && tc="\e[1;32m"; \
    [[ ${chmv} == "77"* ]] && tc="\e[0;31m"; \
    [[ $(stat -c %F "${fd}") == "symbolic link" ]] \
    && chmv="$chmv (Symbolic link)" && tc="\e[1;34m"; \
    echo -e "\e[1;37m$(pwd)/${fd} --> ${tc}chmod=${chmv}\e[0m"' \
    shell {} \;;ti="${bama}Arquivos"
done
}
#
chmod_ | more
#
shopt -u dotglob  # Re-disable it afterward to restore defaults
#
