aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-05-13 17:30:27 +0800
committertypebrook <typebrook@gmail.com>2020-05-13 17:30:27 +0800
commitd88a5e550f89aa49604473cf8820c434f9da3e17 (patch)
treeafedc1550dcc76feb88286600fef7101239a34b7
parent82b76db82cd86693008817806a2c5a160b15b889 (diff)
Suppress error msg with insane filename
-rwxr-xr-xgist3
1 files changed, 2 insertions, 1 deletions
diff --git a/gist b/gist
index ca9f675..11c79bf 100755
--- a/gist
+++ b/gist
@@ -385,7 +385,8 @@ _grep_content() {
385 # grep from filenames 385 # grep from filenames
386 local file=$(ls $repo | grep --color=always -Ei "$1") 386 local file=$(ls $repo | grep --color=always -Ei "$1")
387 # grep from content of files 387 # grep from content of files
388 local content=$(grep --color=always -EHi -m1 "$1" * | head -1) 388 # Abort error message to prevent weird file name, for example: https://gist.github.com/6057f4a3a533f7992c60
389 local content=$(grep --color=always -EHi -m1 "$1" * 2>/dev/null | head -1)
389 390
390 [[ -n $file && file="$file\n" || -n $content ]] \ 391 [[ -n $file && file="$file\n" || -n $content ]] \
391 && hint=false mark="$index " _show_list \ 392 && hint=false mark="$index " _show_list \