Add annna-get-hashtag-url script. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 93b5e7642ad2f3cdc51442f6e14b777b5e0e8ecb DIR parent 6280231ac84634c7c7ee91a93ca6231024e8a1db HTML Author: Annna Robert-Houdin <annna@bitreich.org> 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(-) --- DIR 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 +