Bash Twitter Script

A small expansion to the twitter script: Howto Twitter From the Command Line in Ubuntu!

You still just “twitter Im a dooche” to post your every though.. But you dont have to worry about posting a +140 character message..

# Post to Twitter


# Check msg length

if [ ${#text} -gt $Twitter_Length ]
echo Error – Twitter only allows $Twitter_Length charachters; you have ${#text}
exit 1

#Post it like its hot
curl -s –basic –user “$User:$Pass” –data-ascii “status=`echo $text|tr ‘ ‘ ‘+’`” “” -o /dev/null
echo “Twittered ${#text} characters to $User”

Adds a check to the twitter script to see if the message length isnt too long, hides the curl output even more & gives an expanded final message.. You still need to slash your special characters like !,&,>,.. but there s no getting around that.

Published by Gert


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: