Posts tagged terminal

tweet from bash a better alternative!

4

TSo 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"]

[/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

[codesyntax lang="bash" lines="no"]
curl –basic –user “username:password” –data-ascii “status=echo $@|tr ' ' '+'” “http://twitter.com/statuses/update.json”
[/codesyntax]
——–EDIT!———
I can’t believe I didn’t tell you how to actually post! It’s simple, in your terminal window, just enter
[codesyntax lang="bash" lines="no"]
twitter “Your message goes between the double quotes @danstinebaugh”
[/codesyntax]
That’s it!

tweet from bash

0

first 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

Go to Top