scripts: bin: exclude non-executable files

This commit is contained in:
Simon Michael 2022-04-05 10:05:04 -10:00
parent d84f2b4eb8
commit 5e735b4faf

View File

@ -15,10 +15,12 @@ bin() { # bin [PAT] - list aliases, functions, scripts in ./bin/[bashrc]
| gnused -E -e 's/^alias *//' -e 's/^(function )?(\w+) *\(\) *\{/\2()/' -e 's/#/\t#/' \
# -e "s/=('[^']+'|\"[^\"]+\"|\w+)/=/" # uncomment to hide alias definitions
[[ -d $BINDIR ]] && for F in "$BINDIR"/*; do
[[ -x $F ]] || continue
printf '%s ' "$(basename "$F")"
(grep -IE '^(#|--) ' "$F" 2>/dev/null | gnused -E 's/(#|--)/\t#/'; echo) | head -1
done
) | grep -iE "$PAT" # | sort -b -k2
) | grep -iE "$PAT" \
#| sort -b -k2 # uncomment to sort by name
}
gnused() { # GNU sed, called gsed on mac