Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
parse RSS file to tweet new entries
#!/bin/bash
# parse RSS file to tweet new entries
# author : http://www.cybermonde.org
# needed : feedstail (https://github.com/Psycojoker/feedstail) and ttytter (http://www.floodgap.com/software/ttytter/)
# usage (summary = description) :
# feedstail -u "http://www.domain.name/rss.php" -f "{summary}|{link}" -k summary | /home/sweethome/parserss.sh | /home/sweethome/ttytter.pl -script
# new separator
IFS="|"
# reading summary and link
while read summary link
do
# link (URL) length = ${#link}
# summary (description) length = ${#summary}
# if < 140 signs, display all
if [ $((${#link}+${#summary})) -lt 140 ]
then echo "$summary $link"
# else cut summary and add (...) before link
else
echo "${summary:0:140-${#link}-6}(...) $link"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment