Posts tagged terminal
tweet from bash a better alternative!
4TSo yesterday I spent a good while looking for options that didn’t require me to memorize a huge long string just to post to twitter, and I thought I had found one until I realized that nope, that only works if your in the same bash session and won’t still be there after a reboot or even just a new terminal window.
So trial and error and I have the solution!
in a terminal window go to /usr/local/bin
[codesyntax lang="bash" lines="no"]
|
1 |
cd /usr/local/bin |
[/codesyntax]
then make a file called twitter
[codesyntax lang="bash" lines="no"]
touch twitter
[/codesyntax]
then open it
[codesyntax lang="bash" lines="no"]
nano twitter
[/codesyntax]
and add this command replacing username and password with YOUR twitter account info
echo $@|tr ' ' '+'” “http://twitter.com/statuses/update.json”tweet from bash
0first open your favorite terminal emulator (I prefer terminator) and enter in this command
[codesyntax lang="bash" lines="no"]
tweet(){ curl -u “$1″ -d status=”$2″ “http://twitter.com/statuses/update.xml”; }
[/codesyntax]
then just simply tweet your message using the following format
$ tweet username “Your Message is in quotes”
Really, it’s just that simple!
There’s ton’s more tricks like this over at Commandlinefu.com which is where I picked up this little jem!
http://www.commandlinefu.com/commands/view/3165/update-twitter-via-curl-as-function
