From 50f3d4bef19f1e34d80b7dab9fe724fa17551352 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 2 Nov 2021 13:08:51 +0100 Subject: [PATCH] bin/b: fix exit code for uncompressed binary --- .local/bin/scripts/b | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 4c3e716..5f17d81 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -16,9 +16,11 @@ test -x "$(dirname "$last")" && tput setaf 4 && $elevate file -E "$last" | ( grep -v --color=never 'directory$' || true ) case "$($elevate file --dereference --mime "$last")" in - *inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -XF;; - *binary) expr "$(file "$last")" : ".*: .*compress" >/dev/null && /usr/share/nvim/runtime/macros/less.sh "$@";; - *) $elevate bat --style header "$@" --pager 'less -RXF' + (*inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -XF;; + (*binary) if expr "$(file "$last")" : ".*: .*compress" >/dev/null + then /usr/share/nvim/runtime/macros/less.sh "$@" + fi;; + (*) $elevate bat --style header "$@" --pager 'less -RXF' tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" ;; esac