<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Unix scripts: basic arithmetic operations</title>
	<atom:link href="http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/</link>
	<description>Learn UNIX</description>
	<lastBuildDate>Thu, 26 Jan 2012 23:00:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Unix scripts: how to sum numbers up &#124; Network Solution &#8211; Linux &#8211; windows &#8211; centos- security- cpanel &#8211; plesk -directadmin helm</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-7068</link>
		<dc:creator>Unix scripts: how to sum numbers up &#124; Network Solution &#8211; Linux &#8211; windows &#8211; centos- security- cpanel &#8211; plesk -directadmin helm</dc:creator>
		<pubDate>Mon, 12 Dec 2011 05:59:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-7068</guid>
		<description>[...] my Basic arithmetic operations in Unix shell post last year, I&#8217;ve shown you how to sum up two [...]</description>
		<content:encoded><![CDATA[<p>[...] my Basic arithmetic operations in Unix shell post last year, I've shown you how to sum up two [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mingxi</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-6956</link>
		<dc:creator>mingxi</dc:creator>
		<pubDate>Tue, 18 Jan 2011 17:11:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-6956</guid>
		<description>I tried the double bracket assignments but it doesn&#039;t work. On my machine it will complain :

test: =: unary operator expected

for the line:

test = $(( $i - $j))

Still don&#039;t know what is wrong. But thanks for the explanation!</description>
		<content:encoded><![CDATA[<p>I tried the double bracket assignments but it doesn't work. On my machine it will complain :</p>
<p>test: =: unary operator expected</p>
<p>for the line:</p>
<p>test = $(( $i &#8211; $j))</p>
<p>Still don't know what is wrong. But thanks for the explanation!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neha</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-6865</link>
		<dc:creator>neha</dc:creator>
		<pubDate>Fri, 25 Jun 2010 11:38:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-6865</guid>
		<description>Thanks a lot !! that was really very helpful :)</description>
		<content:encoded><![CDATA[<p>Thanks a lot !! that was really very helpful <img src='http://unixtutorial.s3.amazonaws.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb Reys</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-2055</link>
		<dc:creator>Gleb Reys</dc:creator>
		<pubDate>Thu, 26 Feb 2009 14:43:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-2055</guid>
		<description>Hi Bruce, I hope the above like (comment #7) answers your question.</description>
		<content:encoded><![CDATA[<p>Hi Bruce, I hope the above like (comment #7) answers your question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Unix scripts: how to sum numbers up &#124; UNIX Tutorial: Learn UNIX</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-2038</link>
		<dc:creator>Unix scripts: how to sum numbers up &#124; UNIX Tutorial: Learn UNIX</dc:creator>
		<pubDate>Wed, 25 Feb 2009 15:33:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-2038</guid>
		<description>[...] my Basic arithmetic operations in Unix shell post last year, I&#039;ve shown you how to sum up two [...]</description>
		<content:encoded><![CDATA[<p>[...] my Basic arithmetic operations in Unix shell post last year, I've shown you how to sum up two [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce Chase</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-2027</link>
		<dc:creator>Bruce Chase</dc:creator>
		<pubDate>Tue, 24 Feb 2009 19:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-2027</guid>
		<description>what would the expression look like if you wanted to add a long list of number?</description>
		<content:encoded><![CDATA[<p>what would the expression look like if you wanted to add a long list of number?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb Reys</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-1916</link>
		<dc:creator>Gleb Reys</dc:creator>
		<pubDate>Tue, 10 Feb 2009 22:44:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-1916</guid>
		<description>Glad to have helped, Chima!</description>
		<content:encoded><![CDATA[<p>Glad to have helped, Chima!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chima</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-1915</link>
		<dc:creator>Chima</dc:creator>
		<pubDate>Tue, 10 Feb 2009 17:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-1915</guid>
		<description>Thanks a lot. GOd Bless you.</description>
		<content:encoded><![CDATA[<p>Thanks a lot. GOd Bless you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Another way to use math expressions in shell scripts &#124; UNIX Tutorial: Learn UNIX</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-876</link>
		<dc:creator>Another way to use math expressions in shell scripts &#124; UNIX Tutorial: Learn UNIX</dc:creator>
		<pubDate>Thu, 18 Sep 2008 00:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-876</guid>
		<description>[...] Basic Arithmetic Operations post I&#039;ve shown you how expression evaluation can be used to calculate simple math expressions in your [...]</description>
		<content:encoded><![CDATA[<p>[...] Basic Arithmetic Operations post I've shown you how expression evaluation can be used to calculate simple math expressions in your [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nails Carmody</title>
		<link>http://www.unixtutorial.org/2008/06/arithmetic-operations-in-unix-scripts/comment-page-1/#comment-867</link>
		<dc:creator>Nails Carmody</dc:creator>
		<pubDate>Tue, 16 Sep 2008 06:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.unixtutorial.org/?p=56#comment-867</guid>
		<description>Hi:

An equivalent way of perform this statement:

ELAPSED=$(($FINISH - $START))

with bash/ksh is using the let keyword:

let ELAPSED=&quot;FINISH - START&quot;

It&#039;s a personal choice, but most shell programmers tend to use the method you intially introduced.

You can also set expression entirely withn parenthesis and elimiante some $

((ELAPSED=FINISH - START))

Again, it&#039;s personal preference

Finally, in shell programming, it&#039;s typical to have to increase/decrease a counter - say by 1.  this works:

cnt=0
((cnt=cnt+1))
echo $cnt  # should equal 1

alternatively, similar to &quot;C&quot; you could do this:

cnt=0
((cnt+=1))

Just thought you&#039;d like to know.</description>
		<content:encoded><![CDATA[<p>Hi:</p>
<p>An equivalent way of perform this statement:</p>
<p>ELAPSED=$(($FINISH &#8211; $START))</p>
<p>with bash/ksh is using the let keyword:</p>
<p>let ELAPSED="FINISH &#8211; START"</p>
<p>It's a personal choice, but most shell programmers tend to use the method you intially introduced.</p>
<p>You can also set expression entirely withn parenthesis and elimiante some $</p>
<p>((ELAPSED=FINISH &#8211; START))</p>
<p>Again, it's personal preference</p>
<p>Finally, in shell programming, it's typical to have to increase/decrease a counter &#8211; say by 1.  this works:</p>
<p>cnt=0<br />
((cnt=cnt+1))<br />
echo $cnt  # should equal 1</p>
<p>alternatively, similar to "C" you could do this:</p>
<p>cnt=0<br />
((cnt+=1))</p>
<p>Just thought you'd like to know.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/21 queries in 0.007 seconds using disk: basic
Object Caching 413/429 objects using disk: basic
Content Delivery Network via Amazon Web Services: S3: unixtutorial.s3.amazonaws.com

Served from: www.unixtutorial.org @ 2012-02-08 01:12:36 -->
