Do not output empty recommendation. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit b78b233f0d9ed287e7b82fd5b0e3c4e7c188d4f7
(DIR) parent 37acc0ebfb3bea9fe8a0840350803674cd923f7b
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Mon, 31 May 2021 11:27:20 +0200
Do not output empty recommendation.
Diffstat:
M gutenberg-news | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/gutenberg-news b/gutenberg-news
@@ -1,5 +1,7 @@
#!/bin/sh
+set -x
+
export PATH="$HOME/bin:$PATH"
bookchannel="#bitreich-books"
@@ -8,6 +10,8 @@ bookrec="$(curl -s gopher://gopher.icu/0/gutenberg/newbooks.atom.xml \
| sfeed \
| sed 's,^[0-9]*\t\([^\t]*\)\t\([^\t]*\).*,\1 ( \2 ),' \
| shuf -n 1)"
-
-annna-say -c "${bookchannel}" "Today's book recommendation: ${bookrec}"
+if [ -n "${bookrec}" ];
+then
+ annna-say -c "${bookchannel}" "Today's book recommendation: ${bookrec}"
+fi