From d000e5e10923cab2c044cdc5b593f05b6c694012 Mon Sep 17 00:00:00 2001 From: garhve Date: Tue, 7 Feb 2023 09:24:38 +0800 Subject: showing existing tags and categories --- bash/blog-zola.sh | 15 +++++++++++++-- bash/update_bt.sh | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'bash') diff --git a/bash/blog-zola.sh b/bash/blog-zola.sh index 90f3050..c620789 100755 --- a/bash/blog-zola.sh +++ b/bash/blog-zola.sh @@ -55,7 +55,19 @@ new() { # get basic format d="$(date +%F)" + echo -ne "\x1b[32m" + echo -n "existing categories: " + grep -wrn content -e "categories" | \ + awk -F = '{ print $2 }' | \ + sort | uniq | paste -s -d ' ' + echo -ne "\x1b[0m" read -r -p "category: " category + echo -ne "\x1b[32m" + echo -n "existing tags: " + grep -wrn content -e "tags" | \ + awk -F = '{ print $2 }' | \ + sort | uniq | paste -s -d ' ' + echo -ne "\x1b[0m" read -r -p "tag: " tags read -r -p "math support [y/n]: " m if [ "${m,,}" == 'y' ]; then @@ -76,7 +88,6 @@ math = $math_support +++ EOF - vim "$path".md [ "$?" -eq 0 ] && echo "creation done" [ "$?" -ne 0 ] && echo "creation fail, please check error" && exit 1 @@ -85,7 +96,7 @@ EOF fi read -r -p "do you want to edit now?[y/n] " ans - [ "${ans,,}" == 'y' ] && vim "$path/$name.md" && echo "edit done" + [ "${ans,,}" == 'y' ] && vim "$path.md" && echo "edit done" push diff --git a/bash/update_bt.sh b/bash/update_bt.sh index 5023308..6213d87 100755 --- a/bash/update_bt.sh +++ b/bash/update_bt.sh @@ -1,6 +1,6 @@ #! /bin/sh -site=https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt +site="https://cdn.jsdelivr.net/gh/ngosang/trackerslist@master/trackers_all.txt" file=/home/pi/aria2-config/aria2.conf @@ -10,4 +10,4 @@ current="bt-tracker=$(curl $site | tr -s '[:space:]' | tr '[:space:]' ',')" #sshpass -p 'cctv7701' ssh -T $Addr "sed -i 's|$(grep -A 1 bt-trackers $file)|'\"${current}\"'|' $file" -$(sshpass -p 'cctv7701' ssh -T $Addr "sed -i '410d' $file | echo $current >> $file") +$(sshpass -p 'Ilikeapplepi' ssh -T $Addr "sed -i '410d' $file | echo $current >> $file") -- cgit v1.2.3-70-g09d2