<?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>about:benjie &#187; Bash</title>
	<atom:link href="http://www.benjiegillam.com/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benjiegillam.com</link>
	<description>Benjie Gillam's blog, and home of MythPyWii - probably the best Wii remote (Wiimote) interface to MythTV - see sidebar.</description>
	<lastBuildDate>Tue, 06 Apr 2010 14:14:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Useful Bash Scripts</title>
		<link>http://www.benjiegillam.com/2009/04/useful-bash-scripts/</link>
		<comments>http://www.benjiegillam.com/2009/04/useful-bash-scripts/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 18:44:41 +0000</pubDate>
		<dc:creator>Benjie</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command-line interface]]></category>
		<category><![CDATA[Diff]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.benjiegillam.com/?p=190</guid>
		<description><![CDATA[



Image via Wikipedia



Here&#8217;s a couple of bash scripts I&#8217;ve written recently that might be of use to someone.They work well under Ubuntu, and should work under any GNU/Linux or Unix system with the suitable software installed.
Improved &#8220;svn diff&#8221; command (ignores whitespace, colour highlights output, requires colordiff) &#8211; I put it in /usr/local/bin/svndiff:

#!/bin/bash
svn diff -x -w [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 212px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Bash-org.png"><img title="Bash" src="http://upload.wikimedia.org/wikipedia/en/thumb/4/41/Bash-org.png/202px-Bash-org.png" alt="Bash" height="85" width="202"></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Bash-org.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>Here&#8217;s a couple of <a class="zem_slink" title="Bash" rel="wikipedia" href="http://en.wikipedia.org/wiki/Bash">bash</a> scripts I&#8217;ve written recently that might be of use to someone.They work well under <a class="zem_slink" title="Ubuntu" rel="homepage" href="http://www.ubuntu.com/">Ubuntu</a>, and should work under any <a class="zem_slink" title="Linux" rel="wikipedia" href="http://en.wikipedia.org/wiki/Linux">GNU/Linux</a> or Unix system with the suitable software installed.</p>
<p>Improved &#8220;svn diff&#8221; command (ignores <a class="zem_slink" title="Whitespace (computer science)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Whitespace_%28computer_science%29">whitespace</a>, colour highlights output, requires colordiff) &#8211; I put it in /usr/local/bin/svndiff:</p>
<p><code class="source">
#!/bin/bash
svn diff -x -w $@ | colordiff
</code>
</p>
<p>Improved recursive <a class="zem_slink" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep</a> command (greps recursively, ignores files in the .svn folders, ignores temporary files, highlights output in colour) &#8211; I put it in /usr/local/bin/grepr:</p>
<p><code class="source">
#!/bin/sh
SEARCHTERM=$1;
shift;
find . -type f -a -not -iname &quot;*~&quot; -a -not -iwholename &quot;*/.svn/*&quot; -exec grep -H --color=auto $@ &quot;$SEARCHTERM&quot; &quot;{}&quot; \;</code>
</p>
<p>You might also be interested in my previous &#8220;whoops I deleted files without telling svn&#8221; post <a title="Telling SVN you deleted those files..." href="http://www.benjiegillam.com/2009/02/svn-hint-automatically-removing-manually-deleted-files-from-svn/">here</a>.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/2d71108e-406c-49e4-a42b-24959e42cab0/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_c.png?x-id=2d71108e-406c-49e4-a42b-24959e42cab0" alt="Reblog this post [with Zemanta]"></a><span class="zem-script more-related"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.benjiegillam.com/2009/04/useful-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Hint: Automatically removing manually deleted files from SVN</title>
		<link>http://www.benjiegillam.com/2009/02/svn-hint-automatically-removing-manually-deleted-files-from-svn/</link>
		<comments>http://www.benjiegillam.com/2009/02/svn-hint-automatically-removing-manually-deleted-files-from-svn/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 11:04:30 +0000</pubDate>
		<dc:creator>Benjie</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Command-line interface]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.benjiegillam.com/?p=178</guid>
		<description><![CDATA[



Image via Wikipedia



When deleting files in a working copy of an SVN repository you should do it on the command line: svn rm [filename]. If, however, you don&#8217;t do this (e.g. delete through a gui, or just do &#8220;rm&#8221; without the &#8220;svn&#8220;) then SVN gets confused, and puts a &#8220;!&#8221; in it&#8217;s status before all [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 212px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Bash-org.png"><img title="Bash" src="http://upload.wikimedia.org/wikipedia/en/thumb/4/41/Bash-org.png/202px-Bash-org.png" alt="Bash" width="202" height="85" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Bash-org.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>When deleting files in a working copy of an <a class="zem_slink" title="Social Venture Network" rel="wikipedia" href="http://en.wikipedia.org/wiki/Social_Venture_Network">SVN</a> repository you should do it on the command line: <tt>svn rm [filename]</tt>. If, however, you don&#8217;t do this (e.g. delete through a gui, or just do &#8220;<tt>rm</tt>&#8221; without the &#8220;<tt>svn</tt>&#8220;) then SVN gets confused, and puts a &#8220;<tt>!</tt>&#8221; in it&#8217;s status before all the deleted files. If you <tt>svn update</tt>, all the files will be recovered, rendering all your time spent deleting them wasted. Really you should use <tt>svn rm</tt>, but if it&#8217;s already too late for that, you can use this bash fragment to delete the files from SVN:</p>
<blockquote><p><tt>svn status | grep "^\!" | sed 's/^\! *//g' | xargs svn rm</tt></p></blockquote>
<p>This command does a status command, finds all lines starting with &#8220;<tt>!</tt>&#8220;, and then extracts the filename and runs it through &#8220;<tt>svn rm</tt>&#8221; &#8211; really deleting the file.</p>
<p>Caveats:</p>
<ol>
<li>Manually deleted files are not the only things that makes svn use &#8220;<tt>!</tt>&#8221; &#8211; so beware of this! Ensure you do really want to delete all those files!</li>
<li>This works for filenames which are all_one-word/without/any.spaces but I am not sure if it will work or not for filenames with spaces in.</li>
<li>Use at your own risk. The code is simple enough so you should be able to grok what it does.</li>
</ol>
<p>Enjoy!</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.ghacks.net/2009/01/06/save-your-skin-by-customizing-your-bash-prompt/">Save Your Skin by Customizing Your Bash Prompt</a> (ghacks.net)</li>
<li class="zemanta-article-ul-li"><a href="http://www.modhul.com/2008/11/14/moving-directories-in-a-svn-repository-using-tortoise-svn/">Moving Directories in a SVN Repository using Tortoise SVN</a> (modhul.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/fb66b461-1ba1-4d58-a645-8eded5ab2ab4/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_c.png?x-id=fb66b461-1ba1-4d58-a645-8eded5ab2ab4" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.benjiegillam.com/2009/02/svn-hint-automatically-removing-manually-deleted-files-from-svn/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
