From d88a5e550f89aa49604473cf8820c434f9da3e17 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 13 May 2020 17:30:27 +0800 Subject: Suppress error msg with insane filename --- gist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gist b/gist index ca9f675..11c79bf 100755 --- a/gist +++ b/gist @@ -385,7 +385,8 @@ _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" * | head -1) + # Abort error message to prevent weird file name, for example: https://gist.github.com/6057f4a3a533f7992c60 + local content=$(grep --color=always -EHi -m1 "$1" * 2>/dev/null | head -1) [[ -n $file && file="$file\n" || -n $content ]] \ && hint=false mark="$index " _show_list \ -- cgit v1.2.3-70-g09d2