aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-03-22 20:49:47 +0800
committertypebrook <typebrook@gmail.com>2020-03-22 20:49:47 +0800
commit55774d1352f30964bd22530c4f2ed4e83e5c2a55 (patch)
tree89f97c62f1cb79dfada27f21038fe9f7eee50ff9
parent3c2da44425b822dd6a0af33d50fabaacc62bab48 (diff)
Improve sed usage
-rwxr-xr-xgist2
1 files changed, 1 insertions, 1 deletions
diff --git a/gist b/gist
index 5700358..423de11 100755
--- a/gist
+++ b/gist
@@ -440,7 +440,7 @@ _repo_url() {
440 440
441# Get gist id from index files 441# Get gist id from index files
442_gist_id() { 442_gist_id() {
443 GIST_ID=$(sed -n -e "/^$1 / p" $INDEX | cut -d' ' -f2 | sed -E -e 's#.*/##') 443 GIST_ID=$(sed -En -e "/^$1 / {s#$1 [^ ]+/([[:alnum:]]+) .+#\1#; p; q}" $INDEX)
444 if [[ -z $GIST_ID || ! $1 =~ [0-9a-z]+ ]]; then 444 if [[ -z $GIST_ID || ! $1 =~ [0-9a-z]+ ]]; then
445 echo -e "$(hint=false _show_list | sed -Ee 's/^( *[0-9a-z]+)/\\e[5m\1\\e[0m/')" 445 echo -e "$(hint=false _show_list | sed -Ee 's/^( *[0-9a-z]+)/\\e[5m\1\\e[0m/')"
446 echo 446 echo