<?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>Carbon Silk &#187; shell</title>
	<atom:link href="http://www.carbonsilk.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.carbonsilk.com</link>
	<description>Developing Ideas by James Broad</description>
	<lastBuildDate>Sun, 20 Mar 2011 00:28:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>Amber &#8211; Mac Terminal theme</title>
		<link>http://www.carbonsilk.com/development/amber-mac-terminal-theme/</link>
		<comments>http://www.carbonsilk.com/development/amber-mac-terminal-theme/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 00:46:50 +0000</pubDate>
		<dc:creator>James Broad</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.carbonsilk.com/?p=195</guid>
		<description><![CDATA[I created a terminal theme with a retro look of soft amber tones. I find this really nice to work with and have been using for a couple of months now. Download or fork it on Github. To use: download the amber.terminal file to your computer, open up Terminal.app, go to the preferences, settings tab, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-196" title="amber theme screenshot" src="https://github.com/kulor/Amber-Theme/blob/dbde5f573913e5c2282c94ed405943357cc32061/amber.jpg?raw=true" alt="amber theme screenshot" width="529" height="367" /></p>
<p class="clear">I created a terminal theme with a retro look of soft amber tones. I find this really nice to work with and have been using for a couple of months now. Download or fork it on <a href="http://github.com/kulor/Amber-Theme/tree/master">Github</a>.</p>
<p>To use: download the <a href="http://github.com/kulor/Amber-Theme/blob/dbde5f573913e5c2282c94ed405943357cc32061/amber.terminal">amber.terminal</a> file to your computer, open up Terminal.app, go to the preferences, settings tab, then under the list of themes, click on the settings button and click import, now choose the amber.terminal file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.carbonsilk.com/development/amber-mac-terminal-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing your first shell script</title>
		<link>http://www.carbonsilk.com/development/writing-your-first-shell-script/</link>
		<comments>http://www.carbonsilk.com/development/writing-your-first-shell-script/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 13:32:26 +0000</pubDate>
		<dc:creator>James Broad</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.carbonsilk.com/?p=181</guid>
		<description><![CDATA[Shell scripts are a simple way of completing (repetitive) tasks on the command line, much like many programming languages will be used. You will see ~ something &#8212; ignore the &#8216;~&#8217; this is to signify that it is a command entered onto the command line itself. Writing the code ~ vi helloworld.sh #!/bin/bash # My [...]]]></description>
			<content:encoded><![CDATA[<div><a href="http://www.flickr.com/photos/hindesite/37052873/"><img src="http://farm1.static.flickr.com/33/37052873_2d8bfe13ba_d.jpg" alt="Shell"/></a></div>
<p class="clear">Shell scripts are a simple way of completing (repetitive) tasks on the command line, much like many programming languages will be used. You will see <code>~ something</code> &#8212; ignore the &#8216;~&#8217; this is to signify that it is a command entered onto the command line itself.</p>
<h3>Writing the code</h3>
<p><code>~ vi helloworld.sh</code></p>
<pre>
#!/bin/bash
# My first script
MESSAGE="Hello World!"
echo $MESSAGE
</pre>
<p>Here we have just entered a really simple example of using variables and returning the value.</p>
<h3>Setting the permissions</h3>
<p>We need to set permission to allow the script to be executed, this is needed to be done on all unix environments for something to be run</p>
<p><code>~ chmod +x helloworld.sh</code></p>
<h3>Running the script</h3>
<p><code>~ sh helloworld.sh</code></p>
<pre>Hello World!</pre>
<p>Now you should have the response &#8220;Hello World!&#8221; from running this script.</p>
<h3>Going more advanced</h3>
<p>Lets explore some of the basic options we have to play with in the shell by example.</p>
<h4>Loop test</h4>
<p><code>~ vi looptest.sh</code></p>
<pre>
#!/bin/bash
# My first loop
FILETYPES="xml html css js"
for TYPE in $FILETYPES
    do
        echo 'Looking for' $TYPE 'files'
        find . -name '*'$TYPE
    done
</pre>
<p>Now set the correct permissions and run the script</p>
<p><code>~ chmod +x looptest.sh</code><br />
<code>~ sh looptest.sh</code></p>
<pre>
Looking for xml files
./somefile.xml
Looking for html files
./somefile.html
Looking for css files
./somefile.css
Looking for js files
./somefile.js
</pre>
<h4>If conditional test</h4>
<p><code>~ vi iftest.sh</code></p>
<pre>
#!/bin/bash
# If the file does not exist, make it
FILE='test'
if [ ! -f $FILE ] ; then
    mkdir -p $FILE
fi
ls -las $FILE
</pre>
<p>Now set the correct permissions and run the script</p>
<p><code>~ chmod +x iftest.sh</code><br />
<code>~ sh iftest.sh</code></p>
<p>Hopefully this is enough to help you on your way to making more use of the powers of Unix&#8230;</p>
<h3>Further reading</h3>
<p><a href="http://www.gnu.org/software/bash/manual/html_node/index.html">Bash Manual</a><br />
<a href="http://blog.emson.co.uk/2009/06/18-useful-bash-scripts-for-web-developers/">Useful bash one liner scripts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.carbonsilk.com/development/writing-your-first-shell-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

