diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-30 13:07:00 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-30 13:07:00 +0800 |
| commit | 33e44f1fff14c0ea52adaaaee909de5cf21615b3 (patch) | |
| tree | dbc0592eb9815bffd26a2595f0097f23c51598db | |
| parent | 716c274f53e42205da05d0957b5788afc48ff228 (diff) | |
Fix runtime error
Only output the first line of grep result in files
| -rwxr-xr-x | gist | 2 |
1 files changed, 1 insertions, 1 deletions
| @@ -343,7 +343,7 @@ _grep_content() { | |||
| 343 | # grep from filenames | 343 | # grep from filenames |
| 344 | local file=$(ls $repo | grep --color=always -Ei "$1") | 344 | local file=$(ls $repo | grep --color=always -Ei "$1") |
| 345 | # grep from content of files | 345 | # grep from content of files |
| 346 | local content=$(grep --color=always -EHi -m1 "$1" *) | 346 | local content=$(grep --color=always -EHi -m1 "$1" * | head -1) |
| 347 | 347 | ||
| 348 | [[ -n $file && file="$file\n" || -n $content ]] \ | 348 | [[ -n $file && file="$file\n" || -n $content ]] \ |
| 349 | && hint=false mark="$index " _show_list \ | 349 | && hint=false mark="$index " _show_list \ |