소스 검색

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 9 년 전
부모
커밋
e643c25ea0
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    1
      dotfiles/bash/main.bashrc

+ 1
- 1
dotfiles/bash/main.bashrc 파일 보기

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