Skip to content

Instantly share code, notes, and snippets.

Forked from filipsalomonsson/.bashrc
Created Jul 15, 2010
What would you like to do?
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