Created
June 27, 2012 17:44
-
-
Save bigeasy/3005629 to your computer and use it in GitHub Desktop.
hidegrep
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
# Add to your `.bash_profile`. If you do something that is incredibly | |
# destructive, like `git push --force origin HEAD`, you can then | |
# delete it, how ever many times you've run it, from your history | |
# using `hidegrep --force`. | |
function hidegrep() | |
{ | |
while true; do | |
hist=$(history | grep -e "$1" | head -n 1) | |
if [ -z "$hist" ]; then break; fi | |
echo $hist | |
history -d $(echo $hist | awk '{ print $1 }') | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment