Ver código fonte

Improve greph

Using grep directly could result in "binary file matches" without any
useful info.

This would happen e.g. after renaming some files with badly-encoded
filenames.  Bash history builtin seems to address such cases better.
Alois Mahdal 8 anos atrás
pai
commit
e643c25ea0
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1
    1
      dotfiles/bash/main.bashrc

+ 1
- 1
dotfiles/bash/main.bashrc Ver arquivo

@@ -27,7 +27,7 @@ grepr() {
27 27
 }
28 28
 
29 29
 greph() {
30
-    <"$HOME/.bash_history" grep "$@"
30
+    history | sed 's/^  *//; s/  / /' | cut -d' ' -f2- | grep "$@"
31 31
 }
32 32
 
33 33
 gitcd() {