Last active
March 19, 2020 04:17
-
-
Save brock/feb6280c435cb7d75909 to your computer and use it in GitHub Desktop.
Alias checker
This file contains 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
#!/bin/zsh | |
# aliascheck by @brock | |
# Description: checks each zsh command and reminds you if you already have an alias for that command | |
# Instructions: | |
# copy aliascheck.sh to ~/bin/aliascheck | |
# chmod +x ~/bin/aliascheck | |
# uncomment or modify line 14 below to source your aliases | |
# add the following to your ~/.zshrc or zsh profile: | |
# | |
# preexec() { zsh $(which aliascheck) $1} | |
# | |
# source your aliases, works best if aliases are separate from your zshrc or profile | |
# source ~/.zsh_aliases | |
# you may need to tell zsh to expand aliases, though I didn't need it | |
# setopt aliases | |
# zsh preexec passes the entire string in the command as $1 (see the zshrc snippet in the next file) | |
# echo 'this is dollar one: ' $1 | |
FOUND_ALIAS=`alias | grep "='${1}'"` | |
if [ ! -z $FOUND_ALIAS ]; then | |
echo "#########################" | |
echo "# Alias Check found: $FOUND_ALIAS" | |
echo "#########################" | |
fi |
This file contains 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
#!/bin/zsh | |
# add this line to your .zshrc or zsh profile | |
preexec() { zsh $(which aliascheck) $1} |
Author
brock
commented
Sep 16, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment