<?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>the fancy part of the web &#187; shell</title>
	<atom:link href="http://blog.tolleiv.de/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tolleiv.de</link>
	<description>is elsewhere - this is just about all sorts of web related work with a small factor of fanciness</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:52:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>bash: small improvement for the &#8220;cd&#8221; builtin</title>
		<link>http://blog.tolleiv.de/2009/06/improve-bash-cd-builtin/</link>
		<comments>http://blog.tolleiv.de/2009/06/improve-bash-cd-builtin/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 21:54:34 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=126</guid>
		<description><![CDATA[If you use the shell and walk around in directories wou [...]]]></description>
			<content:encoded><![CDATA[<p>If you use the shell and walk around in directories wouldn&#8217;t it be cool to have &#8220;cd &#8230;&#8221; to move 2 levels up, &#8220;cd &#8230;.&#8221; to move 3 levels up &#8230;? I&#8217;m not sure if there&#8217;s an easier way to resolve it but the following lines work pretty nice so far and they just made it into my default .bashrc <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<pre name="code" class="php">cd() {
	if [[ "$1" =~ ^\.\.\.+$  ]]; then
		cd `echo "$1" | sed 's/\./..\//g' | sed 's/^\.\.\///g'`
	else
		builtin cd "$1"
	fi
}</pre>
<p>For different older shell/bash versions you might need quotes around the regex.</p>
<p>Btw <a href="http://books.google.de/books?id=WQCSxv9vfPkC&amp;lpg=PA84&amp;ots=OiT8hUe10J&amp;dq=bash%20function%20with%20the%20same%20name%20as%20command&amp;pg=PP1" target="_blank">O&#8217;Reilly&#8217;s &#8220;Learning the Bash&#8221;</a> is available within Google Books</p>
<p><em>Edit: another very important bookmark for bashscripting is the <a href="http://tldp.org/LDP/abs/html/">Advanced Bash-Scripting Guide</a></em></p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/06/improve-bash-cd-builtin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shell command: translate</title>
		<link>http://blog.tolleiv.de/2009/04/shell-command-translare/</link>
		<comments>http://blog.tolleiv.de/2009/04/shell-command-translare/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 16:22:55 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=33</guid>
		<description><![CDATA["Translate, squeeze, and/or delete characters from stan [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;Translate, squeeze, and/or delete characters from standard input,<br />
writing to standard output.&#8221;</p></blockquote>
<p>&#8230; that&#8217;s the manpage description of the shell-command I just found (with the help of a good friend) &#8230; and besides sed this is a very handy way to do simple string-operations on stdin.</p>
<p>He used it to replace (old) Mac newline characters with Unix newline charaters within files (as seen on <a href="http://en.wikipedia.org/wiki/Newline">wikipedia</a>):<br />
<code>tr '\r' '\n' &lt; old.file &gt; new.file</code></p>
<p>Btw I still think that it&#8217;s stupid that users still have all the hazzle with <a href="http://en.wikipedia.org/wiki/Newline">newline charaters</a> &#8211; why can&#8217;t the OS-developers just recognize all types of newlines? <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/04/shell-command-translare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the subshell is your friend</title>
		<link>http://blog.tolleiv.de/2009/04/the-subshell-is-your-friend/</link>
		<comments>http://blog.tolleiv.de/2009/04/the-subshell-is-your-friend/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 21:10:29 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=43</guid>
		<description><![CDATA[Today I tried to find a way to track the time of a shel [...]]]></description>
			<content:encoded><![CDATA[<p>Today I tried to find a way to track the time of a shell-command and to log that runtime into a file. I was already aware of the <strong>time </strong>command which is a bash build-in. Due to that it passes its output directly to the user without using either stdout or stderr and therefore there&#8217;s no &#8220;easy&#8221; way to redirect the output directly into a file.</p>
<p>But bash als provides subshells and in this case that&#8217;s how you can use the output <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  (which is passed on stderr in this case).</p>
<p><code>(time sleep 5) 2&gt; time.log</code></p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/04/the-subshell-is-your-friend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8230; much better way to use your shell</title>
		<link>http://blog.tolleiv.de/2009/04/much-better-way-to-use-your-shell/</link>
		<comments>http://blog.tolleiv.de/2009/04/much-better-way-to-use-your-shell/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 19:22:38 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=18</guid>
		<description><![CDATA[ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.tolleiv.de/2009/04/much-better-way-to-use-your-shell/"><em>Click here to view the embedded video.</em></a></p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/04/much-better-way-to-use-your-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>find the newest file within a folder&#8230;.</title>
		<link>http://blog.tolleiv.de/2009/04/find-the-newest-file-within-a-folder/</link>
		<comments>http://blog.tolleiv.de/2009/04/find-the-newest-file-within-a-folder/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 20:14:42 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=3</guid>
		<description><![CDATA[These are two neat little commands to find the newest a [...]]]></description>
			<content:encoded><![CDATA[<p>These are two neat little commands to find the newest and oldest file within a folder and it&#8217;s subfolder:<br />
<code> find . -type f -printf "%T@ %p \n" | sort -n -k 1,1 | awk '{print $2}' | tail -n 1<br />
find . -type f -printf "%T@ %p \n" | sort -n -k 1,1 | awk '{print $2}' | head -n 1</code><br />
If you&#8217;d like to know how old/young these files are try these two:<br />
<code>find . -type f -printf "%T@ %C+ %p \n" | sort -n -k 1,1 | tail -n 1<br />
find . -type f -printf "%T@ %C+ %p \n" | sort -n -k 1,1 | head -n 1</code></p>
<p>I hope that&#8217;s a good starter for the &#8220;blog&#8221; <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/04/find-the-newest-file-within-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
