diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-22 20:49:47 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-22 20:49:47 +0800 |
| commit | 55774d1352f30964bd22530c4f2ed4e83e5c2a55 (patch) | |
| tree | 89f97c62f1cb79dfada27f21038fe9f7eee50ff9 | |
| parent | 3c2da44425b822dd6a0af33d50fabaacc62bab48 (diff) | |
Improve sed usage
| -rwxr-xr-x | gist | 2 |
1 files changed, 1 insertions, 1 deletions
| @@ -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 |