<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Random String of Bits &#187; twitter</title>
	<atom:link href="http://stringofbits.net/tag/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://stringofbits.net</link>
	<description>Sequences of bytes about Technology, Games, Programming, and more</description>
	<lastBuildDate>Thu, 25 Feb 2010 14:36:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Twitter from the command line</title>
		<link>http://stringofbits.net/2009/07/twitter-from-the-command-line/</link>
		<comments>http://stringofbits.net/2009/07/twitter-from-the-command-line/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 20:38:30 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=129</guid>
		<description><![CDATA[I&#8217;ve recently started playing with twitter. A nice way to use it via the command-line (using curl) was suggested here. I have taken that and improved slightly on it. Here is the result: #!/bin/sh echo -n "twitter&#62; " read text while [ ${#text} -gt 140 ]; do echo echo "Message too long; used ${#text}/140 characters." [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started playing with twitter.  A nice way to use it via the command-line (using curl) was suggested <a href="http://binnyva.blogspot.com/2007/03/using-twitter-part-1-command-line.html">here</a>.  I have taken that and improved slightly on it.</p>
<p><span id="more-129"></span></p>
<p>Here is the result:</p>
<blockquote><p><code>#!/bin/sh<br />
echo -n "twitter&gt; "<br />
read text</p>
<p>while [ ${#text} -gt 140 ]; do</p>
<p>echo<br />
echo "Message too long; used ${#text}/140 characters."<br />
echo<br />
echo -n "twitter&gt; "<br />
read text</p>
<p>done</p>
<p>echo<br />
echo "Message is ${#text}/140 characters.  Press enter to post, or Ctrl+C to cancel."<br />
read</p>
<p>curl --basic --user "username:password" --data-ascii "status=`echo $text|tr ' ' '+'`" "http://twitter.com/statuses/update.json" &amp;&gt; /dev/null<br />
</code>
</p></blockquote>
<p>To use the script, copy all of that into a file somewhere in your path, then make the file executable (e.g., <code>chmod 755 /usr/local/bin/twitter</code>).  Now you can type &#8216;twitter&#8217;, type in your tweet, and you&#8217;re done!</p>
<p>I even set up fluxbox so that mod4+t launches a terminal with the script running.  To do that, I added this to ~/.fluxbox/keys:</p>
<blockquote><p>
<code><br />
Mod4 t :Exec xterm -e "twitter"<br />
</code>
</p></blockquote>
<p>If you&#8217;re not familiar with &#8216;mod4&#8242;, it is the Windows key on most PC keyboards.</p>
<p>I&#8217;ll eventually get around to writing a slightly more full-featured twitter updater in c or c++.  Until then, enjoy this script!</p>
 <img src="http://stringofbits.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=129" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2009/07/twitter-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
