diff options
-rw-r--r-- | bash/bashrc.d/hgrep.bash | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc.d/hgrep.bash b/bash/bashrc.d/hgrep.bash new file mode 100644 index 00000000..0c31a213 --- /dev/null +++ b/bash/bashrc.d/hgrep.bash @@ -0,0 +1,9 @@ +# Search shell history file for a pattern. If you put your whole HISTFILE +# contents into memory, then you probably don't need this, as you can just do: +# +# $ history | grep PATTERN +# +hgrep() { + grep -- "${@:?}" "${HISTFILE:?}" +} + |