aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/hgrep.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-06-27 10:51:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2014-06-27 10:51:15 +1200
commit1729f6aeb09dc14b0139ec458648c8beb706a138 (patch)
tree6aa49bbd75aa9a981b8fdd05bf4fd151307cca87 /bash/bashrc.d/hgrep.bash
parentAdd Unicode snowman digraph (diff)
downloaddotfiles-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.bash9
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:?}"
+}
+