in

 

AgileJoe

Answering all world issues with, "...it depends..."

Twittering from the command line

So I was experimenting with Twitter last night and started to use their RESTful services from the command line. 

Why you may ask? Well sometimes I just want to tweet something quickly and I don't want to bother with opening a client or web page.  So I through together this simple bash script.

tweet()
  {
    curl -u <username>:<password> -d status="$1" http://twitter.com/statuses/update.xml
  }

Simply add this to your .bash_profile and you can tweet from the command line all day.

tweet "Tweeting from the command line is awesome!" 

I love RESTful services despite popular belief.  :-) 

Published May 21 2008, 12:47 AM by Joe Ocampo
Filed under: ,

Comments

 

Jason Meridth said:

Worked for me!

Awesome.

Side notes: I put mine in my .bashrc file, same affect and I also had to install curl (apt-get install curl OR yum install curl).

May 21, 2008 7:07 AM
 

bogardj said:

Haha that's pretty cool.  Reminds me of leetwit:

code.google.com/.../leetwit

May 21, 2008 7:44 AM
 

Joe Ocampo said:

@jason

Yeah I forgot that Mac's have curl preinstalled

Glad it worked.

May 21, 2008 9:36 AM
 

Joe Ocampo said:

@jimmy

interesting project, very nice! I must partake in such goodness.

May 21, 2008 9:37 AM
 

terry said:

@joe

pretty sure i should make an installer that adds your bash pwnage to leetwit. that would be pretty handy. weekend project woot.

May 21, 2008 10:13 AM
 

Joe Ocampo said:

@terry

That would be awesome Terry.  Use you mad MacSkillz. :-)

May 22, 2008 9:54 PM
 

GBGames said:

Just so you know, since I was unfamiliar with using curl, I thought that maybe it knew what <username>:<password> was, until I realized that I needed to replace those parts with my actual username and password.

Also, if you don't want to put your password in clear text in your .bash_profile, you can leave out :<password>, and curl will prompt you for one each time you use it.

August 20, 2008 5:46 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Copyright Los Techies 2007. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems