From 8eef8400a1ac137b88db62491b15fb3eaa0d1d35 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 4 Apr 2019 15:25:27 +0200 Subject: [PATCH] Bashbot Version 0.5 - fix count message --- bashbot.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 78c42e3..d30fd4f 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -10,7 +10,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.5-0-gfd81668 +#### $$VERSION$$ v0.5-2-g09678a1 # # Exit Codes: # - 0 sucess (hopefully) @@ -535,11 +535,13 @@ case "$1" in rm -f -r $TMPDIR/$3 ;; "count") - echo "A total of $(wc -l ${COUNT} | sed 's/count//g')users used me." + echo "A total of $(wc -l <"${COUNT}") users used me." + exit ;; "broadcast") - echo "Sending the broadcast $* to $(wc -l ${COUNT} | sed 's/count//g')users." - [ "$(wc -l ${COUNT} | sed 's/ count//g')" -gt "300" ] && sleep="sleep 0.5" + USERS="$(wc -l <"${COUNT}")" + echo "Sending the broadcast $* to $USERS users." + [ "$USERS" -gt "300" ] && sleep="sleep 0.5" shift for f in "$(cat ${COUNT})";do send_message ${f//COUNT} "$*"; $sleep;done ;;