Created
September 4, 2013 18:36
-
-
Save EvanLovely/6440960 to your computer and use it in GitHub Desktop.
Bash Function to search through your Bash Aliases and Functions and display helpful text in the prompt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # search bash aliases | |
| sba() { | |
| cat ~/.bash_aliases | grep -i -A 1 "^#.*$*" | |
| cat ~/.bash_aliases | grep -i -B 1 "^alias.*$*" | |
| cat ~/.bash_functions | grep -i -A 1 "^#.*$*" | |
| } |
Author
Author
I would like it to work when I have several under a header like this:
# ls better
alias la="ls -aF"
alias ld="ls -ld"
alias ll="ls -l"
alias lt='ls -At1 && echo "------Oldest--"'
alias ltr='ls -Art1 && echo "------Newest--"'Hat tip to Brett Terpstra for some of the aliases
Author
I would also like it if one could retrieve multi-line comments before a function/alias.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works when your file looks like this: