<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Let Bash do the math: Doing calculations using that bash</title>
	<atom:link href="http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/</link>
	<description>syslogd goes web 2.0</description>
	<lastBuildDate>Sun, 27 Dec 2009 12:55:55 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: E.M.</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-12878</link>
		<dc:creator>E.M.</dc:creator>
		<pubDate>Sun, 27 Dec 2009 12:55:55 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-12878</guid>
		<description>Really?

~$ echo $((5*(10+2)))
60
~$ echo $((5*\(10+2\)))
bash: 5*\(10+2\): syntax error: operand expected (error token is &quot;\(10+2\)&quot;)</description>
		<content:encoded><![CDATA[<p>Really?</p>
<p>~$ echo $((5*(10+2)))<br />
60<br />
~$ echo $((5*\(10+2\)))<br />
bash: 5*\(10+2\): syntax error: operand expected (error token is &#8220;\(10+2\)&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jaenmedina</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-12877</link>
		<dc:creator>jaenmedina</dc:creator>
		<pubDate>Sun, 27 Dec 2009 12:47:51 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-12877</guid>
		<description>If you want to evaluate multiple math expressions the parentheses must be escaped. This is necessary so the shell will not treat them as a reference to a sub-shell.
For example, if you want to evaluate 100*(50-16), you will have to write 100*\(50-16\)

Hope this helps.

Source: Burtch, Ken. Linux Shell Scripting with BASH. Indianapolis, Indiana: Sams Publishing. 2004. Page 95</description>
		<content:encoded><![CDATA[<p>If you want to evaluate multiple math expressions the parentheses must be escaped. This is necessary so the shell will not treat them as a reference to a sub-shell.<br />
For example, if you want to evaluate 100*(50-16), you will have to write 100*\(50-16\)</p>
<p>Hope this helps.</p>
<p>Source: Burtch, Ken. Linux Shell Scripting with BASH. Indianapolis, Indiana: Sams Publishing. 2004. Page 95</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Calcoli aritmetici dalla bash di linux &#171; Oracle and other</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-12362</link>
		<dc:creator>Calcoli aritmetici dalla bash di linux &#171; Oracle and other</dc:creator>
		<pubDate>Tue, 20 Oct 2009 13:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-12362</guid>
		<description>[...] operatori supportati sono molti, elencati anche in questo blog, ad esempio ** per calcolare la [...]</description>
		<content:encoded><![CDATA[<p>[...] operatori supportati sono molti, elencati anche in questo blog, ad esempio ** per calcolare la [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ken</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-11986</link>
		<dc:creator>ken</dc:creator>
		<pubDate>Thu, 20 Aug 2009 15:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-11986</guid>
		<description>Figured it out... it should be

( i=0; while [ $i -ne 5 ]; do echo Increment: $((++i)) ; done )</description>
		<content:encoded><![CDATA[<p>Figured it out&#8230; it should be</p>
<p>( i=0; while [ $i -ne 5 ]; do echo Increment: $((++i)) ; done )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ken</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-11985</link>
		<dc:creator>ken</dc:creator>
		<pubDate>Thu, 20 Aug 2009 14:02:16 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-11985</guid>
		<description>Why doesn&#039;t this increment?

 ( i=0; while [ $i!=5 ]; do echo Increment:  $((++${i})) ; done )</description>
		<content:encoded><![CDATA[<p>Why doesn&#8217;t this increment?</p>
<p> ( i=0; while [ $i!=5 ]; do echo Increment:  $((++${i})) ; done )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: E.M.</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-9591</link>
		<dc:creator>E.M.</dc:creator>
		<pubDate>Mon, 09 Mar 2009 21:00:47 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-9591</guid>
		<description>Your way will work, but it just looks more complicated.

Basically, your way is saying &#039;do 3+4, then use this like a variable, times this variable by 3 then make it act like another variable&#039;.

Where as my way basically does it all in one go.

It probably doesn&#039;t make much difference either way, but it&#039;s just easier to read IMO :-)</description>
		<content:encoded><![CDATA[<p>Your way will work, but it just looks more complicated.</p>
<p>Basically, your way is saying &#8216;do 3+4, then use this like a variable, times this variable by 3 then make it act like another variable&#8217;.</p>
<p>Where as my way basically does it all in one go.</p>
<p>It probably doesn&#8217;t make much difference either way, but it&#8217;s just easier to read IMO <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sysblog</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-9590</link>
		<dc:creator>sysblog</dc:creator>
		<pubDate>Mon, 09 Mar 2009 18:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-9590</guid>
		<description>Thanks for sharing that information! I cannot remember where I had my info from but maybe it just was due to a different version of bash.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing that information! I cannot remember where I had my info from but maybe it just was due to a different version of bash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: E.M.</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-9587</link>
		<dc:creator>E.M.</dc:creator>
		<pubDate>Mon, 09 Mar 2009 11:44:17 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-9587</guid>
		<description>No, it doesn&#039;t.

~$  echo $(((3+4)*3))
21</description>
		<content:encoded><![CDATA[<p>No, it doesn&#8217;t.</p>
<p>~$  echo $(((3+4)*3))<br />
21</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-7964</link>
		<dc:creator>Juan</dc:creator>
		<pubDate>Tue, 25 Nov 2008 15:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-7964</guid>
		<description>where i can find some how to related with advanced operations in bash?</description>
		<content:encoded><![CDATA[<p>where i can find some how to related with advanced operations in bash?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sysblog</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-6522</link>
		<dc:creator>sysblog</dc:creator>
		<pubDate>Wed, 13 Aug 2008 19:02:19 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-6522</guid>
		<description>as far as I know bash itself only knows about integers. But there&#039;s an article that could help you at &lt;a href=&quot;http://www.novell.com/coolsolutions/tools/17043.html&quot; rel=&quot;nofollow&quot;&gt;cool solutions on novell.com&lt;/a&gt; that uses bc and a small script.

Cheers.</description>
		<content:encoded><![CDATA[<p>as far as I know bash itself only knows about integers. But there&#8217;s an article that could help you at <a href="http://www.novell.com/coolsolutions/tools/17043.html" rel="nofollow">cool solutions on novell.com</a> that uses bc and a small script.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: julien</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-6518</link>
		<dc:creator>julien</dc:creator>
		<pubDate>Wed, 13 Aug 2008 16:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-6518</guid>
		<description>How does it work with decimal number??????
I always get some errors.</description>
		<content:encoded><![CDATA[<p>How does it work with decimal number??????<br />
I always get some errors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suma valluru</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-837</link>
		<dc:creator>suma valluru</dc:creator>
		<pubDate>Wed, 12 Sep 2007 11:57:31 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-837</guid>
		<description>hi, arithmetic math is the perfect one in all the math topics...

Cheers,
Suma valluru
---------------------------
www.esumz.com</description>
		<content:encoded><![CDATA[<p>hi, arithmetic math is the perfect one in all the math topics&#8230;</p>
<p>Cheers,<br />
Suma valluru<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<a href="http://www.esumz.com" rel="nofollow">http://www.esumz.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sysblog</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-727</link>
		<dc:creator>sysblog</dc:creator>
		<pubDate>Mon, 03 Sep 2007 15:26:15 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-727</guid>
		<description>Thanks, katm.

But be warned that &lt;strong&gt;every single&lt;/strong&gt; grouping has to come in double brackets. So for something like $latex (3+4)*3$ it&#039;s &lt;code&gt;$(($((3+4))*3))&lt;/code&gt;. So for some complex mathematics it would even be easier to use lisp :D But I like the quick and dirty &lt;code&gt;$((2**32))&lt;/code&gt; for $latex 2^{32}$ for example.

Cheers.</description>
		<content:encoded><![CDATA[<p>Thanks, katm.</p>
<p>But be warned that <strong>every single</strong> grouping has to come in double brackets. So for something like <img src='http://l.wordpress.com/latex.php?latex=%283%2B4%29%2A3&#038;bg=ffffe3&#038;fg=000000&#038;s=0' alt='(3+4)*3' title='(3+4)*3' class='latex' /> it&#8217;s <code>$(($((3+4))*3))</code>. So for some complex mathematics it would even be easier to use lisp <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  But I like the quick and dirty <code>$((2**32))</code> for <img src='http://l.wordpress.com/latex.php?latex=2%5E%7B32%7D&#038;bg=ffffe3&#038;fg=000000&#038;s=0' alt='2^{32}' title='2^{32}' class='latex' /> for example.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: katm</title>
		<link>http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/comment-page-1/#comment-726</link>
		<dc:creator>katm</dc:creator>
		<pubDate>Mon, 03 Sep 2007 15:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/#comment-726</guid>
		<description>Oh now this is just nifty.

And as a Linux noob, I think even I can follow it.

Just another toy to play with :)</description>
		<content:encoded><![CDATA[<p>Oh now this is just nifty.</p>
<p>And as a Linux noob, I think even I can follow it.</p>
<p>Just another toy to play with <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
