From d76df5c1c95413b6e635bc257715ec9951b7e29e Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Sun, 4 Aug 2024 14:32:38 +0300 Subject: [PATCH] {bash,zsh}rc: be just a bit less lazy about the getfacl --- rc/bashrc | 9 +++++++-- rc/zshrc | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rc/bashrc b/rc/bashrc index 46e36a19..49bc17c8 100755 --- a/rc/bashrc +++ b/rc/bashrc @@ -922,11 +922,16 @@ adduser-to-group() { usermod -aG "$2" "$1" } -# Very lazy ACL aware ls +# Lazyish ACL aware ls unalias ls ls() { env ls --all --color=auto --human-readable "$@" - getfacl --absolute-names --skip-base "$@" + if hash getfacl 2> /dev/null; then + if [[ -d "$@" || -f "$@" ]]; then + printf "\n" + getfacl --absolute-names --skip-base "$@" + fi + fi } alias ll="ls -la" diff --git a/rc/zshrc b/rc/zshrc index e06a66e8..6913f285 100755 --- a/rc/zshrc +++ b/rc/zshrc @@ -908,11 +908,16 @@ adduser-to-group() { usermod -aG "$2" "$1" } -# Very lazy ACL aware ls +# Lazyish ACL aware ls unalias ls ls() { env ls --all --color=auto --human-readable "$@" - getfacl --absolute-names --skip-base "$@" + if hash getfacl 2> /dev/null; then + if [[ -d "$@" || -f "$@" ]]; then + printf "\n" + getfacl --absolute-names --skip-base "$@" + fi + fi } alias ll="ls -la"