diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 7eb34cb..3ec0ca9 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -7,8 +7,10 @@ set -eo pipefail for last; do true; done last=${last:-.} -# Elevate permissions if the file exists but is not accessible -test -x "$(dirname $last)" && { test -r "$last" || ! test -e "$last"; } || elevate=sudo +# Elevate permissions if the file is not accessible +test -x "$(dirname "$last")" && + { test -r "$last" || ! test -e "$last"; } || + elevate=sudo tput setaf 4 && $elevate file -E "$last" | ( grep -v --color=never 'directory$' || true ) case "$($elevate file --dereference --mime "$last")" in