abort log on missing title

This commit is contained in:
James Tomasino 2018-12-02 21:09:05 -05:00
parent 3d784cc5bc
commit 74ee638eb9
1 changed files with 8 additions and 4 deletions

View File

@ -128,10 +128,14 @@ check_log () {
# prompt for title and prepare output
printf "\\n Title for message %s? " "$(basename "$u" | sed 's/\.[^.]*$//')"
read -r title
printf "0%s - %s\\t%s\\n" "$ship" "$title" "$u" | cat - /var/gopher/listing.gophermap > "$tmp" && cat "$tmp" > /var/gopher/listing.gophermap && rm "$tmp"
printf "\\n %s .... Sent.\\n" "$(basename "$u" | sed 's/\.[^.]*$//')"
# shellcheck source=cosmic-log
. "${SCRIPTPATH}/cosmic-log"
if [ ! -z "$title" ]; then
printf "0%s - %s\\t%s\\n" "$ship" "$title" "$u" | cat - /var/gopher/listing.gophermap > "$tmp" && cat "$tmp" > /var/gopher/listing.gophermap && rm "$tmp"
printf "\\n %s .... Sent.\\n" "$(basename "$u" | sed 's/\.[^.]*$//')"
# shellcheck source=cosmic-log
. "${SCRIPTPATH}/cosmic-log"
else
printf "\\n %s .... No title, abort.\\n" "$(basename "$u" | sed 's/\.[^.]*$//')"
fi
else
printf "\\n %s .... Skipped.\\n" "$(basename "$u" | sed 's/\.[^.]*$//')"
fi