Created
February 19, 2015 10:57
-
-
Save cybermonde/6fc24881302e5c80044f to your computer and use it in GitHub Desktop.
parse RSS file to tweet new entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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