<?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>dev.enekoalonso.com &#187; shell</title>
	<atom:link href="http://dev.enekoalonso.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Wed, 12 Oct 2011 21:40:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Clone your OSX terminal window</title>
		<link>http://dev.enekoalonso.com/2011/07/13/clone-your-osxterminal-window/</link>
		<comments>http://dev.enekoalonso.com/2011/07/13/clone-your-osxterminal-window/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 16:13:22 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[osascript]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[profile]]></category>
		<category><![CDATA[scpt]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=710</guid>
		<description><![CDATA[Sometimes, when working on a terminal window I would like to open a new window on the exact same location or path. This little AppleScript will do the trick: tell app &#34;Terminal&#34; to do script &#34;cd \&#34;&#39;`pwd`&#39;\&#34;&#34; From the command line: osascript -e &#39;tell app &#34;Terminal&#34; to do script &#34;cd \&#8221;&#39;`pwd`&#39;\&#8221;&#34;&#39; You can also create [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, when working on a terminal window I would like to open a new window on the exact same location or path. This little AppleScript will do the trick:</p>
<div class="geshi no applescript">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">tell</span> app <span class="st0">&quot;Terminal&quot;</span> <span class="kw1">to</span> do <span class="kw1">script</span> <span class="st0">&quot;cd <span class="es0">\&quot;</span>&#39;`pwd`&#39;<span class="es0">\&quot;</span>&quot;</span></div>
</li>
</ol>
</div>
<p>From the command line:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">osascript -e <span class="st0">&#39;tell app &quot;Terminal&quot; to do script &quot;cd <span class="es0">\&#8221;</span>&#39;</span>`<span class="kw3">pwd</span>`<span class="st0">&#39;<span class="es0">\&#8221;</span>&quot;&#39;</span></div>
</li>
</ol>
</div>
<p>You can also create an alias in ~/.profile for easy access:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">alias</span> <span class="re2">nt=</span><span class="st0">&quot;osascript -e &#39;tell app <span class="es0">\&quot;</span>Terminal<span class="es0">\&quot;</span> to do script <span class="es0">\&quot;</span>cd <span class="es0">\\</span><span class="es0">\&quot;</span>&#39;`pwd`&#39;<span class="es0">\\</span><span class="es0">\&quot;</span><span class="es0">\&quot;</span>&#39;&quot;</span></div>
</li>
</ol>
</div>
<p>Enjoy!</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>October 5, 2010 -- <a href="http://dev.enekoalonso.com/2010/10/05/javascript-console-in-the-terminal-command-line/" title="Javascript console in the terminal (command line)">Javascript console in the terminal (command line)</a> (1)</li><li>January 3, 2009 -- <a href="http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/" title="Check your server status with email notification">Check your server status with email notification</a> (0)</li><li>December 5, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/" title="Enabling PHP5 on Mac OS X Leopard">Enabling PHP5 on Mac OS X Leopard</a> (0)</li><li>August 9, 2011 -- <a href="http://dev.enekoalonso.com/2011/08/09/uninstalling-brew-so-i-can-reinstall/" title="Uninstalling brew (so I can reinstall)">Uninstalling brew (so I can reinstall)</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2011/07/13/clone-your-osxterminal-window/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Check your server status with email notification</title>
		<link>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/</link>
		<comments>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 19:34:11 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[automatically]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=238</guid>
		<description><![CDATA[I wanted to do this for a while and never really sit down and code it. Yesterday I came across this pretty nice script by Ben from Coderholic which does exactly that: check your server status and send you an email if it is other than 200 (OK). #!/bin/bash &#160; &#160; # Query a supplied [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to do this for a while and never really sit down and code it. Yesterday I came across this pretty nice <a href="http://www.coderholic.com/server-status-checker-shell-script-2/">script by Ben from Coderholic</a> which does exactly that: check your server status and send you an email if it is other than 200 (OK).</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0">#!/bin/bash &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Query a supplied URL and output an error message if &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># the status code was not 200. Can be used as a cron &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># task to check if a server is up or not. &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Ben Dowling &#8211; http://www.coderholic.com &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># The URL to query &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re4">$#</span> -ne <span class="nu0">1</span> <span class="br0">&#93;</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">then</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Usage: $0 &lt;URL&gt;&quot;</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">exit</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="re2">url=</span>$<span class="nu0">1</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re2">response=</span>$<span class="br0">&#40;</span>curl -s -I -L <span class="re1">$url</span> <span class="sy0">|</span> <span class="kw2">grep</span> HTTP<span class="br0">&#41;</span>; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="re2">status=</span>$<span class="br0">&#123;</span>response<span class="co0">#* }; # Strip off characters up to the first space &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">status=</span>$<span class="br0">&#123;</span>status:<span class="nu0">0</span>:<span class="nu0">3</span><span class="br0">&#125;</span>; <span class="co0"># Just use the 3 digit status code &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;$status&quot;</span> <span class="sy0">!</span>= <span class="st0">&quot;200&quot;</span> <span class="br0">&#93;</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">then</span> &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Error fetching $url. Status code &#39;$status&#39;&quot;</span>; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span></div>
</li>
</ol>
</div>
<p>Nice.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>July 13, 2011 -- <a href="http://dev.enekoalonso.com/2011/07/13/clone-your-osxterminal-window/" title="Clone your OSX terminal window">Clone your OSX terminal window</a> (1)</li><li>October 12, 2011 -- <a href="http://dev.enekoalonso.com/2011/10/12/command-line-scripting-with-node-js/" title="Command line scripting with Node.js">Command line scripting with Node.js</a> (0)</li><li>August 6, 2011 -- <a href="http://dev.enekoalonso.com/2011/08/06/python-script-remove-empty-folders/" title="Python script: remove empty folders">Python script: remove empty folders</a> (1)</li><li>October 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/10/01/having-fun-with-node-js-redis/" title="Having fun with node.js &#038; Redis">Having fun with node.js &#038; Redis</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling PHP5 on Mac OS X Leopard</title>
		<link>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/</link>
		<comments>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 05:07:43 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=85</guid>
		<description><![CDATA[I had done this already at work, but for some reason my MacBook Pro still didn&#8217;t &#8220;understand&#8221; PHP. Well, I&#8217;ve decided it&#8217;s time to activate it: # Use your favorite editor mate /etc/apache2/httpd.conf # Uncomment the line: #LoadModule php5_module libexec/apache2/libphp5.so # Restart apache sudo apachectl restart Done. Related Posts:January 31, 2010 -- CloudServers: Creating a [...]]]></description>
			<content:encoded><![CDATA[<p>I had done this already at work, but for some reason my MacBook Pro still didn&#8217;t &#8220;understand&#8221; PHP. Well, I&#8217;ve decided it&#8217;s time to activate it:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Use your favorite editor</span></div>
</li>
<li class="li1">
<div class="de1">mate <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>httpd.conf</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Uncomment the line:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#LoadModule php5_module libexec/apache2/libphp5.so</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Restart apache</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> apachectl restart</div>
</li>
</ol>
</div>
<p>Done.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/" title="CloudServers: Creating a new web server with httpd, php &#038; memcached">CloudServers: Creating a new web server with httpd, php &#038; memcached</a> (1)</li><li>July 13, 2011 -- <a href="http://dev.enekoalonso.com/2011/07/13/clone-your-osxterminal-window/" title="Clone your OSX terminal window">Clone your OSX terminal window</a> (1)</li><li>October 5, 2010 -- <a href="http://dev.enekoalonso.com/2010/10/05/javascript-console-in-the-terminal-command-line/" title="Javascript console in the terminal (command line)">Javascript console in the terminal (command line)</a> (1)</li><li>August 9, 2011 -- <a href="http://dev.enekoalonso.com/2011/08/09/uninstalling-brew-so-i-can-reinstall/" title="Uninstalling brew (so I can reinstall)">Uninstalling brew (so I can reinstall)</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

