From 5e735b4faf7cfe3ef3cc7bf46044bb1a6c8d50af Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 5 Apr 2022 10:05:04 -1000 Subject: [PATCH] scripts: bin: exclude non-executable files --- bin/bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/bashrc b/bin/bashrc index 7acfb7acb..3ba23fb0f 100755 --- a/bin/bashrc +++ b/bin/bashrc @@ -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