From: Ian Kelling Date: Wed, 9 Oct 2024 05:45:19 +0000 (-0400) Subject: minor improvement: if ls has nonzero exit, return it X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;p=small-misc-bash minor improvement: if ls has nonzero exit, return it --- diff --git a/ll-function b/ll-function index f683464..5b2c36b 100644 --- a/ll-function +++ b/ll-function @@ -41,7 +41,7 @@ EOF ;; esac local x y perm line binls sizePadding middle tail size \ - max_hl_digits hardlinks initial_space hardlink_spacing + max_hl_digits hardlinks initial_space hardlink_spacing out local max_hl_digits=0 local -a lines hl binls=$(type -P ls) @@ -50,6 +50,8 @@ EOF $binls -lA "$@" return fi + out=$("$binls" -lAh --color=always "--time-style=+%m-%d %Y +%m-%d %I:%M %P" "$@") local aclchar=false # there's no way to tell if ls uses the acl specifier unless we loop over the data twice # the 11th char is either @@ -87,8 +89,7 @@ EOF fi hl+=("$hardlinks") fi - done< <( "$binls" -lAh --color=always "--time-style=+%m-%d %Y -%m-%d %I:%M %P" "$@" ) + done<<<"$out" hardlink_spacing=$((max_hl_digits + 1))