Created
July 14, 2010 21:30
-
-
Save filipsalo/476116 to your computer and use it in GitHub Desktop.
If you ever forget to give grep some filenames and end up waiting while it waits for input, stuff this into your .bashrc.
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
# Call grep, with stdin closed if it is a terminal. | |
# | |
# Avoids the "eternal wait" problem when you've forgotten | |
# to specify a filename. | |
function grep { (tty -s && exec <&-; exec $(which grep) "$@"); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment