Created
February 3, 2013 09:53
-
-
Save dorentus/4701106 to your computer and use it in GitHub Desktop.
WAAAAAAAAAAAAAAAAAAAAAAAGH! for bash
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
type old_command_not_found_handle 2>/dev/null | grep -q 'is a function' > /dev/null | |
if [ $? -ne 0 ]; then | |
eval "$(echo "old_command_not_found_handle()"; declare -f command_not_found_handle | tail -n +2)" | |
fi | |
command_not_found_handle () { | |
if [[ ! "$1" ]] ; then | |
old_command_not_found_handle $@ | |
return $? | |
fi | |
n=$1 | |
if echo $n| perl -ne 'exit(/^waa+gh!?$/i ? 0:1)' ; then | |
if which lolcat > /dev/null; then | |
n=$(echo $n | lolcat -f) | |
fi | |
echo $n | |
return 0 | |
else | |
old_command_not_found_handle $@ | |
return $? | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment