Skip to content

Instantly share code, notes, and snippets.

@henrik
Forked from filipsalomonsson/.bashrc
Created July 15, 2010 06:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/476573 to your computer and use it in GitHub Desktop.
Save henrik/476573 to your computer and use it in GitHub Desktop.
grep that doesn't wait forever for STDIN with unspecified filename.
# 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 <&-; $(which grep) $@); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment