<?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>Open Sourcery &#187; tip</title>
	<atom:link href="http://www.opensourcery.co.uk/tag/tip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opensourcery.co.uk</link>
	<description>Open Source Support and Consultancy</description>
	<lastBuildDate>Wed, 27 Aug 2008 12:45:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Preserve formatting when pasting in vi/vim</title>
		<link>http://www.opensourcery.co.uk/2008/07/preserve-formatting-when-pasting-in-vivim/</link>
		<comments>http://www.opensourcery.co.uk/2008/07/preserve-formatting-when-pasting-in-vivim/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 16:34:53 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.uk/?p=63</guid>
		<description><![CDATA[When copy and pasting into vi or vim, you can often end up with badly formatted text. This is often referred to as &#8220;the staircase effect&#8221;. It&#8217;s easily prevented by entering :set paste before you paste, when you have finished turn it off again with :set nopaste.
a
<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>When copy and pasting into vi or vim, you can often end up with badly formatted text. This is often referred to as &#8220;the staircase effect&#8221;. It&#8217;s easily prevented by entering <code>:set paste</code> before you paste, when you have finished turn it off again with <code>:set nopaste</code>.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.uk/2008/07/preserve-formatting-when-pasting-in-vivim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BASH quick tip: Change to last directory</title>
		<link>http://www.opensourcery.co.uk/2008/05/bash-change-to-last-director/</link>
		<comments>http://www.opensourcery.co.uk/2008/05/bash-change-to-last-director/#comments</comments>
		<pubDate>Fri, 16 May 2008 19:55:21 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.uk/?p=50</guid>
		<description><![CDATA[You can change to the previous working directory in BASH by using the command:
cd - 
a
<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>You can change to the previous working directory in BASH by using the command:</p>
<blockquote><p><code>cd - </code></p></blockquote>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.uk/2008/05/bash-change-to-last-director/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing parameters in a BASH shell script</title>
		<link>http://www.opensourcery.co.uk/2008/04/parsing-parameters-bash-shell-script/</link>
		<comments>http://www.opensourcery.co.uk/2008/04/parsing-parameters-bash-shell-script/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 13:19:57 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[BASH scripting]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.opensourcery.co.uk/?p=40</guid>
		<description><![CDATA[This is a simple alternative to using getopts to parse parameters in a BASH shell script which makes use of the powerful parameter substitution functions in BASH. It should be sufficient for most scripts:

until [[ ! "$*" ]]; do
&#160;&#160;if [[ ${1:0:2} = '--' ]]; then
&#160;&#160;&#160;&#160;PAIR=${1:2}
&#160;&#160;&#160;&#160;PARAMETER=`echo ${PAIR%=*} &#124; tr [:lower:] [:upper:]`
&#160;&#160;&#160;&#160;eval P_$PARAMETER=${PAIR##*=}
&#160;&#160;fi
&#160;&#160;shift
done


The script processes parameters in [...]<p>a</p>
]]></description>
			<content:encoded><![CDATA[<p>This is a simple alternative to using getopts to parse parameters in a BASH shell script which makes use of the powerful parameter substitution functions in BASH. It should be sufficient for most scripts:</p>
<blockquote><p><code><br />
until [[ ! "$*" ]]; do<br />
&nbsp;&nbsp;if [[ ${1:0:2} = '--' ]]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;PAIR=${1:2}<br />
&nbsp;&nbsp;&nbsp;&nbsp;PARAMETER=`echo ${PAIR%=*} | tr [:lower:] [:upper:]`<br />
&nbsp;&nbsp;&nbsp;&nbsp;eval P_$PARAMETER=${PAIR##*=}<br />
&nbsp;&nbsp;fi<br />
&nbsp;&nbsp;shift<br />
done<br />
</code>
</p></blockquote>
<p>The script processes parameters in the format <code>--<em>name</em>=<em>value</em></code> or <code>--<em>flag</em></code>.</p>
<p>So, executing: <code>./example.sh --number=123 --show</code></p>
<p>Will result in the variable $P_NUMBER being set to &#8220;123&#8243; and the variable $P_SHOW evaluating to true as it is set, albeit to a empty value.</p>
<p>a</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opensourcery.co.uk/2008/04/parsing-parameters-bash-shell-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
