megafono_bot.sh 564 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. #
  3. # CONFIGURATION
  4. #
  5. # Interval between two consecutive posts
  6. SLEEP_INTERVAL=3h
  7. # File containing the toots to post
  8. DATA_FILE=test.txt
  9. # A prefix for all toots of this bot
  10. TOOT_PREFIX="#avviso%0A"
  11. #
  12. # CONFIGURATION END
  13. #
  14. extract_image() {
  15. sed -n -e 's/.*<img>\(.*\)<\/img>.*/\1/p' <<< $1
  16. }
  17. extract_text() {
  18. sed -e "s/<img>.*<\/img>/ /g" <<< $1
  19. }
  20. while :
  21. do
  22. # Last line should be empty, so we dont need an additional read here
  23. # after the while loop
  24. while read line
  25. do
  26. ./toot.sh $line
  27. sleep ${SLEEP_INTERVAL}
  28. done < ${DATA_FILE}
  29. done