Add annna-get-hashtag-url script. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 93b5e7642ad2f3cdc51442f6e14b777b5e0e8ecb | |
parent 6280231ac84634c7c7ee91a93ca6231024e8a1db | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Wed, 8 Apr 2020 13:24:06 +0200 | |
Add annna-get-hashtag-url script. | |
Diffstat: | |
A annna-get-hashtag-url | 23 +++++++++++++++++++++++ | |
1 file changed, 23 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/annna-get-hashtag-url b/annna-get-hashtag-url | |
@@ -0,0 +1,23 @@ | |
+#!/bin/sh | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s #tag\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+modbase="/home/annna/bin/modules/" | |
+hashtagfile="${modbase}hashtags/hashtags.txt" | |
+ | |
+hashtags() { | |
+ cat ${hashtagfile} 2>/dev/null | |
+} | |
+ | |
+tagname="$1" | |
+tagline="$(printf "%s\n" "$(hashtags)" | grep "^${tagname} ")" | |
+taguri="$(printf "%s\n" "${tagline}" | cut -d ' ' -f 2-)" | |
+[ -z "$taguri" ] && exit 1 | |
+ | |
+printf "%s\n" "${taguri}" | |
+exit 0 | |
+ |