Custom Search

Tag Archives: command line

twitter script for linux

0
Filed under General, Hardware, Linux, software
Tagged as , , , ,

Well let me give you an interesting script i found on Tech Republic………..

Its how to Tweet from the command line using cURL, its very simple and to the point….just like a script should be
tweet.sh

#!/bin/sh
tweet="${@}"
user="username"
pass="sekret"
if [ $(echo "${tweet}" | wc -c) -gt 140 ]; then
echo "FATAL: The tweet is longer than 140 characters!"
exit 1
fi
curl -k -u ${user}:${pass} -d status="${tweet}" https://twitter.com/statuses/update.xml >/dev/null 2>&1
if [ "$?" == "0" ]; then
echo "Successful tweet!"
fi


to us it just type this
$ ~/bin/tweet "social server rules"
the only other thing to worry about is you have to escape “?”, “!” -> “\?”, “\!”