Skip to content

Instantly share code, notes, and snippets.

@filipsalomonsson
Created July 14, 2010 21:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save filipsalomonsson/476116 to your computer and use it in GitHub Desktop.
Save filipsalomonsson/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.
# 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