<?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>Smart Pandian &#187; Add new tag</title>
	<atom:link href="http://smartpandian.com/tag/add-new-tag/feed/" rel="self" type="application/rss+xml" />
	<link>http://smartpandian.com</link>
	<description>as simple as that...</description>
	<lastBuildDate>Fri, 03 Sep 2010 04:52:34 +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>Unix Shell Arguments</title>
		<link>http://smartpandian.com/unix-shell-arguments/</link>
		<comments>http://smartpandian.com/unix-shell-arguments/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 17:58:51 +0000</pubDate>
		<dc:creator>Pandian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Unix Shell]]></category>

		<guid isPermaLink="false">http://smartpandian.com/?p=377</guid>
		<description><![CDATA[A quick tutorial on Unix Shell Arguments. <a href="http://smartpandian.com/unix-shell-arguments/">Continue reading <span class="meta-nav">&#8594;</span></a>


No related posts.]]></description>
			<content:encoded><![CDATA[<p>For the past few weeks, I have been working on <a class="zem_slink" title="Unix shell" rel="wikipedia" href="http://en.wikipedia.org/wiki/Unix_shell">Unix Shell</a>, to accomplish variety of tasks such as parsing files, transferring data, updating databases etc. Today is the day, i primarily worked on Arguments. Arguments are inputs to the program, and are also referred as parameters interchangeably.</p>
<p>Lets see how to use the arguments in the korn <a class="zem_slink" title="Shell script" rel="wikipedia" href="http://en.wikipedia.org/wiki/Shell_script">shell script</a>, beginning with unix shell annotation for arguments.</p>
<blockquote><p><strong>$1, $2, $3 &#8230; $n</strong> First, Second, Third&#8230; and nth Argument<br />
<strong>$#</strong> (hash)    Count of Arguments<br />
<strong>$*</strong> (Asterisk)    Arguments concatenated by space<br />
<strong>$@</strong> (at the rate)    Array of Arguments</p></blockquote>
<p>Here is an sample shell script &#8220;accessArguments.ksh&#8221;.</p>
<pre class="brush: bash;">
$ cat accessArguments.ksh
# accessArguments.ksh
echo Zeroth Argument: $0
echo First Argument: $1
echo Second Argument: $2
echo Total No. Of Arguments: $#
echo Arguments: $*
for var in $@
do
echo Argument $var
done
</pre>
<p>Now lets see the output of the above script,  with inputs as 10 and 15</p>
<pre class="brush: bash;">
$ accessArguments.ksh 10 15
Zeroth Argument : accessArguments.ksh
First Argument: 10
Second Argument: 15
Total No. Of Arguments: 2
Arguments: 10 15
Argument 10
Argument 15
$
</pre>
<p>Hope this example envisions you with the knowledge of using Arguments in Unix Shell.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/94c4adea-3b9f-44a9-b434-5d46c3a38302/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=94c4adea-3b9f-44a9-b434-5d46c3a38302" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>




	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;title=Unix%20Shell%20Arguments&amp;bodytext=A%20quick%20tutorial%20on%20Unix%20Shell%20Arguments." title="Digg"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;title=Unix%20Shell%20Arguments&amp;notes=A%20quick%20tutorial%20on%20Unix%20Shell%20Arguments." title="del.icio.us"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;t=Unix%20Shell%20Arguments" title="Facebook"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;t=Unix%20Shell%20Arguments" title="MySpace"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;title=Unix%20Shell%20Arguments" title="StumbleUpon"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F" title="Technorati"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Unix%20Shell%20Arguments&amp;url=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F" title="Slashdot"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://bookmarks.yahoo.com/toolbar/savebm?u=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;t=Unix%20Shell%20Arguments&opener=bm&amp;ei=UTF-8&amp;d=A%20quick%20tutorial%20on%20Unix%20Shell%20Arguments." title="Yahoo! Bookmarks"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="Yahoo! Bookmarks" alt="Yahoo! Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fsmartpandian.com%2Funix-shell-arguments%2F&amp;submitHeadline=Unix%20Shell%20Arguments&amp;submitSummary=A%20quick%20tutorial%20on%20Unix%20Shell%20Arguments.&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://smartpandian.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://smartpandian.com/unix-shell-arguments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
