Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Semi-auto-generated, nicely formatted, apropos-like list of your custom bash functions
Posted 10-01-2015 at 12:35 AM by the dsc
Code:
bold=$(tput bold) normal=$(tput sgr0) lsfunctions () { tail -n+10 /path/to/custom-bash-functions | grep "()" | sort | sed 's|(.*#||' | sed "s|^|${bold}|;s|\ |${normal}\ |" }
"lsfunctions" would be like "apropos /usr/bin/*", or whatever really works, but restricted to your custom bash functions, given that they're documented on the line with the "()", like:
Code:
c () # - command line calculator, bc { echo "$*" | sed 's|^+||;s|x|*|g' | bc -l }
Quote:
c - command line calculator, bc
(And that's what I meant by "auto-generated", just that it greps from the extant documentation and makes the first word bold, instead of one having to create a separate list in a "more" manual manner)
With some tweaking it could grep keywords, like apropos does.
Total Comments 0