From 33e44f1fff14c0ea52adaaaee909de5cf21615b3 Mon Sep 17 00:00:00 2001 From: typebrook Date: Mon, 30 Mar 2020 13:07:00 +0800 Subject: Fix runtime error Only output the first line of grep result in files --- gist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gist b/gist index d61f86b..5c393d5 100755 --- a/gist +++ b/gist @@ -343,7 +343,7 @@ _grep_content() { # grep from filenames local file=$(ls $repo | grep --color=always -Ei "$1") # grep from content of files - local content=$(grep --color=always -EHi -m1 "$1" *) + local content=$(grep --color=always -EHi -m1 "$1" * | head -1) [[ -n $file && file="$file\n" || -n $content ]] \ && hint=false mark="$index " _show_list \ -- cgit v1.2.3-70-g09d2