Skip to content

Instantly share code, notes, and snippets.

@asross
Last active December 10, 2015 14:08
Show Gist options
  • Save asross/4445325 to your computer and use it in GitHub Desktop.
Save asross/4445325 to your computer and use it in GitHub Desktop.
A bash function which, for arguments foo, bar, and baz, evaluates $ grep foo | grep bar | grep baz
function cgrep {
local command=""
for var in "$@"; do
command+="grep $var | "
done
eval ${command% | }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment