<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:osnews="http://osnews.com/rss2#">
	<channel>
		<title>OSNews: </title>
		<link>http://www.osnews.com/story/19923/A_Beginner_s_Guide_to_Korn_Shell_Scripting</link>
		<description>Exploring the Future of Computing</description>
		<language>en-us</language>
		<copyright>Copyright 2001-2009, David Adams</copyright>
		<webMaster>adam+nospam@osnews.com</webMaster>
		<lastBuildDate>Mon, 06 Jul 2009 17:22:13 GMT</lastBuildDate>
		<image>
			<url>http://www.osnews.com/images/osnews.gif</url>
			<title>OSNews.com</title>
			<link>http://www.osnews.com</link>
		</image>
		<item>
			<title>Badly phrased</title>
			<link>http://osnews.com/thread?320260</link>
			<guid isPermaLink="true">http://osnews.com/thread?320260</guid>
			<description>It should read as The user of the Operating System, not the OS itself. The OS itself, it's programs, communicate through POSIX API calls, not through the shell. The shell is meant to be used by the user.Edited 2008-06-26 18:15 UTC</description>
			<pubDate>Thu, 26 Jun 2008 18:14:00 GMT</pubDate>
			<author>donotreply@osnews.com (sbenitezb)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>OpenBSD</title>
			<link>http://osnews.com/thread?320283</link>
			<guid isPermaLink="true">http://osnews.com/thread?320283</guid>
			<description>Also OpenBSD uses the Korn shell as default shell (actually the Public Domain Korn Shell).</description>
			<pubDate>Thu, 26 Jun 2008 20:33:00 GMT</pubDate>
			<author>donotreply@osnews.com (MaxKlokan)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Similarities to (ba)sh, form</title>
			<link>http://osnews.com/thread?320284</link>
			<guid isPermaLink="true">http://osnews.com/thread?320284</guid>
			<description>The mentioned examples would mostly run with the Bourne Shell (sh) and the Bourne Again Shell (bash), too. One important difference is the use of [[...]] for testing expressions; here, (ba)sh uses [...].<br />
<br />
ksh and (ba)sh use the same kind of variable association; evaluation from a program call done with $(...) is compatible; (ba)sh allows you to use `...`, too. The basic contructs demonstrated (&quot;if&quot;, &quot;for&quot;-&quot;do&quot;, &quot;case&quot;) are compatible to (ba)sh.<br />
<br />
A difference you see at the tirst look is the use of &quot;print&quot; (ksh internal) instead of &quot;echo&quot;.<br />
<br />
One thing about consistent form: The article features conditionals in this form:<br />
<br />
if [[ $? = 0 ]]; then<br />
________print &quot;The date command was successful&quot;<br />
else<br />
________print &quot;The date command failed<br />
fi<br />
<br />
but illustrates iterations in this way:<br />
<br />
for username in $(cat $PASSWORD_FILE | cut -f1 -d:)<br />
do<br />
________print $username<br />
done<br />
<br />
Here, you can use this form, too:<br />
<br />
for username in $(cat $PASSWORD_FILE | cut -f1 -d:); do<br />
________print $username<br />
done<br />
<br />
You can substitute the line break between the &quot;for&quot; statement and &quot;do&quot; with a &quot;;&quot; which makes shell scripts tidy, in my opinion. If you use tabs to indent functional groups and find an ending sign, such as &quot;fi&quot;, &quot;done&quot; or &quot;esac&quot;, you just need to go up in the same column and the first thing you'll find is the expression causing this ending sign (except &quot;else&quot; in &quot;if&quot; conditionals). If you don't like the &quot;;&quot;, use the line break (and proper indentation) method everywhere.<br />
<br />
A more tidy approach to the if_error function is welcome.<br />
<br />
function if_error {<br />
________if [[ $? -ne 0 ]]; thenfunction<br />
________________print &quot;$1&quot;<br />
________________exit $?<br />
________fi<br />
}<br />
<br />
Statements of the same &quot;level&quot; should start in the same column. Tidy scripting code is very important especially if you want to give your work to others for education and further use.<br />
<br />
Sorry I had to use underscores. HTML does eat up the spaces, and there's no  available here.<br />
<br />
If you're familiar with (ba)sh, reading and creating ksh scripts (at this level of complexity) won't be problematic for you. Nice article!</description>
			<pubDate>Thu, 26 Jun 2008 20:35:00 GMT</pubDate>
			<author>donotreply@osnews.com (Doc Pain)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: OpenBSD</title>
			<link>http://osnews.com/thread?320295</link>
			<guid isPermaLink="true">http://osnews.com/thread?320295</guid>
			<description><div class="cquote">Also OpenBSD uses the Korn shell as default shell (actually the Public Domain Korn Shell). </div><br />
<br />
On Sun Solaris, the Korn shell is mostly used as the interactive shell, while scripts (system scripts) rely on the UNIX's standard shell, the Bourne shell. The ksh's syntax compatibility to sh makes it appealing to its users.<br />
<br />
I can't remember what the default dialog shell was on IRIX, I think it was the C shell. FreeBSD uses csh by default. Both of these UNIXes use sh for system scripting.</description>
			<pubDate>Thu, 26 Jun 2008 21:33:00 GMT</pubDate>
			<author>donotreply@osnews.com (Doc Pain)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: Similarities to (ba)sh, form</title>
			<link>http://osnews.com/thread?320303</link>
			<guid isPermaLink="true">http://osnews.com/thread?320303</guid>
			<description>Notable post ...<br />
Thanks for sharing !<br />
Don't you a have a webpage in which you publish all this stuff?<br />
I've been following your posts ... and if you do have a page or a blog, I would very much like to bookmark it <img src="/images/emo/smile.gif" alt=";)" /> <br />
<br />
Blessings</description>
			<pubDate>Thu, 26 Jun 2008 23:05:00 GMT</pubDate>
			<author>donotreply@osnews.com (gnemmi)</author>
			<category>Comments</category>
		</item>
	</channel>
</rss>
