diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-06-27 10:51:15 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-06-27 10:51:15 +1200 |
commit | 1729f6aeb09dc14b0139ec458648c8beb706a138 (patch) | |
tree | 6aa49bbd75aa9a981b8fdd05bf4fd151307cca87 /bash/bashrc.d/hgrep.bash | |
parent | Add Unicode snowman digraph (diff) | |
download | dotfiles-1729f6aeb09dc14b0139ec458648c8beb706a138.tar.gz dotfiles-1729f6aeb09dc14b0139ec458648c8beb706a138.zip |
Alias to search HISTFILE
Diffstat (limited to 'bash/bashrc.d/hgrep.bash')
-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:?}" +} + |