#!/bin/bash # Based in part on article found at http://www.ibm.com/developerworks/linux/library/l-friendfeed/index.html maxitems=5 user=yourusername pass=secretpassword puburl="http://stream.tllts.org/identica/api/statuses/public_timeline.xml" posturl="http://stream.tllts.org/identica/api/statuses/update.xml" function readpub() { clear curl -s $puburl > /tmp/tweet.tmp count=0 echo "-------------------------------------------" while read line do if $(echo "${line}" | grep -q "text>") then echo "${line}" | sed 's///g' | sed 's/<\/text>//g' fi if $(echo "${line}" | grep -q "created_at>") then echo -n "${line}" | sed 's// @: /g' | sed 's/<\/created_at>//g' fi if $(echo "${line}" | grep -q "screen_name>") then echo "${line}" | sed 's// by: /g' | sed 's/<\/screen_name>//g' fi if $(echo "${line}" | grep -q "") then echo "-------------------------------------------" count=$((count + 1)) if [ $count -eq $maxitems ] then break fi fi done < /tmp/tweet.tmp } function postmsg() { curl -s -u ${user}:${pass} -d status="$msg" ${posturl} 2>&1>/dev/null } getopts "rp:" flag case "${flag}" in r) readpub ;; p) msg=${OPTARG}; postmsg; readpub ;; esac