From 7bf9eb1c113261a10dcd9e0cc0ea07822516ee30 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 29 Jan 2020 10:53:11 +0800 Subject: update --- scripts/gist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/gist') diff --git a/scripts/gist b/scripts/gist index 5de68c7..19ab6a6 100755 --- a/scripts/gist +++ b/scripts/gist @@ -195,8 +195,9 @@ _sync_repos() { echo Everything is fine! } +# get gist id from index files _gist_id() { - GIST_ID=$(cat $index $starred 2> /dev/null | sed -n "/^$1 / p" | cut -d' ' -f2 | sed -E 's#.*/##') + GIST_ID=$( (grep -hs '' $index $starred || true) | sed -n "/^$1 / p" | cut -d' ' -f2 | sed -E 's#.*/##') if [[ -z "$GIST_ID" ]]; then echo -e "Not a valid index: \e[31m$1\e[0m" echo Use the index number in the first column instead: -- cgit v1.2.3-70-g09d2