<?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: Simple Maths in the Unix Shell</title>
	<atom:link href="http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/</link>
	<description>UNIX / Linux Shell Hints and Tips&#160;&#160;&#160;&#160;&#160;&#160;(a http://steve-parker.org/sh/sh.shtml subproject)</description>
	<lastBuildDate>Sat, 07 Nov 2009 15:13:13 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Commandes Unix &#171; Francesco&#8217;s FAQ</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5257</link>
		<dc:creator>Commandes Unix &#171; Francesco&#8217;s FAQ</dc:creator>
		<pubDate>Tue, 26 May 2009 13:30:55 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5257</guid>
		<description>[...] -pour faire des math dans une shell : ici [...]</description>
		<content:encoded><![CDATA[<p>[...] -pour faire des math dans une shell : ici [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unixshell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5234</link>
		<dc:creator>unixshell</dc:creator>
		<pubDate>Mon, 26 Jan 2009 17:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5234</guid>
		<description>That works with Bash (possibly ksh too, can&#039;t remember off the top of my head) but it doesn&#039;t work with the original Bourne shell, nor with dash (which looks likely to replace bash as the default root shell in many upcoming Linux distro&#039;s).

Using bash-specific stuff is fine, if we are sure of having bash installed; if not, then we need to be more generic in our approach :-(</description>
		<content:encoded><![CDATA[<p>That works with Bash (possibly ksh too, can&#8217;t remember off the top of my head) but it doesn&#8217;t work with the original Bourne shell, nor with dash (which looks likely to replace bash as the default root shell in many upcoming Linux distro&#8217;s).</p>
<p>Using bash-specific stuff is fine, if we are sure of having bash installed; if not, then we need to be more generic in our approach <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ddouthitt</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5233</link>
		<dc:creator>ddouthitt</dc:creator>
		<pubDate>Mon, 26 Jan 2009 16:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5233</guid>
		<description>I&#039;m surprised no one mentioned the real solution to shell math.  Using the above example:

a=1
b=2
c=3
d=$(( $a + $b $c ))
echo &quot;$d&quot;

unlike expr, dc, and bc, this requires nothing more than the shell, and requires no exec calls (and no binaries to be read in from disk).</description>
		<content:encoded><![CDATA[<p>I&#8217;m surprised no one mentioned the real solution to shell math.  Using the above example:</p>
<p>a=1<br />
b=2<br />
c=3<br />
d=$(( $a + $b $c ))<br />
echo &#8220;$d&#8221;</p>
<p>unlike expr, dc, and bc, this requires nothing more than the shell, and requires no exec calls (and no binaries to be read in from disk).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unixshell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-3004</link>
		<dc:creator>unixshell</dc:creator>
		<pubDate>Mon, 03 Sep 2007 13:37:42 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-3004</guid>
		<description>We dont&#039; use set in Bourne, so replace that line with this:

d=`expr $a + $b + $c`

Should work fine.</description>
		<content:encoded><![CDATA[<p>We dont&#8217; use set in Bourne, so replace that line with this:</p>
<p>d=`expr $a + $b + $c`</p>
<p>Should work fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: muralee</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-3000</link>
		<dc:creator>muralee</dc:creator>
		<pubDate>Mon, 03 Sep 2007 12:40:11 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-3000</guid>
		<description>why the below code does not work

a=1
b=2
c=3
set d=`expr [[$a + $b] + $c ]`
echo &quot;$d&quot;

what is the fix req.</description>
		<content:encoded><![CDATA[<p>why the below code does not work</p>
<p>a=1<br />
b=2<br />
c=3<br />
set d=`expr [[$a + $b] + $c ]`<br />
echo &#8220;$d&#8221;</p>
<p>what is the fix req.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: More maths stuff - bc in detail &#171; *nix Shell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-134</link>
		<dc:creator>More maths stuff - bc in detail &#171; *nix Shell</dc:creator>
		<pubDate>Sun, 08 Apr 2007 00:22:36 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-134</guid>
		<description>[...]  There&#8217;s a great post about bc at basicallytech.com - I think that I&#8217;ve already covered most of the same ground, but it&#8217;s got lots of great [...]</description>
		<content:encoded><![CDATA[<p>[...]  There&#8217;s a great post about bc at basicallytech.com &#8211; I think that I&#8217;ve already covered most of the same ground, but it&#8217;s got lots of great [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unixshell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-77</link>
		<dc:creator>unixshell</dc:creator>
		<pubDate>Mon, 26 Mar 2007 23:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-77</guid>
		<description>Updating again... I&#039;ve done another, related post, here: http://nixshell.wordpress.com/2007/03/26/calculating-averages/

It deals specifically with averages, but there is more detail about bc, also.</description>
		<content:encoded><![CDATA[<p>Updating again&#8230; I&#8217;ve done another, related post, here: <a href="http://nixshell.wordpress.com/2007/03/26/calculating-averages/" rel="nofollow">http://nixshell.wordpress.com/2007/03/26/calculating-averages/</a></p>
<p>It deals specifically with averages, but there is more detail about bc, also.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Calculating Averages &#171; *nix Shell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-74</link>
		<dc:creator>Calculating Averages &#171; *nix Shell</dc:creator>
		<pubDate>Mon, 26 Mar 2007 22:30:42 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-74</guid>
		<description>[...]  The Simple Maths post seems to be the most popular article in the so-far short life of this [...]</description>
		<content:encoded><![CDATA[<p>[...]  The Simple Maths post seems to be the most popular article in the so-far short life of this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: unixshell</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5</link>
		<dc:creator>unixshell</dc:creator>
		<pubDate>Tue, 30 Jan 2007 01:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-5</guid>
		<description>bc is indeed far more powerful than expr. Both are rather awkward, though, with their own quirks. I guess if I&#039;m that upset, I should fix it instead of griping about it. It&#039;s been over a decade since I studied Finite State Machines (FSMs) and the like, so I&#039;m probably not the person to provide the ultra-powerful shell-maths tool. There is certainly a need for one, so any students out there looking for a PhD thesis... this could be an idea!</description>
		<content:encoded><![CDATA[<p>bc is indeed far more powerful than expr. Both are rather awkward, though, with their own quirks. I guess if I&#8217;m that upset, I should fix it instead of griping about it. It&#8217;s been over a decade since I studied Finite State Machines (FSMs) and the like, so I&#8217;m probably not the person to provide the ultra-powerful shell-maths tool. There is certainly a need for one, so any students out there looking for a PhD thesis&#8230; this could be an idea!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Constantin</title>
		<link>http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-4</link>
		<dc:creator>Constantin</dc:creator>
		<pubDate>Mon, 29 Jan 2007 14:20:27 +0000</pubDate>
		<guid isPermaLink="false">http://nixshell.wordpress.com/2007/01/29/simple-maths-in-the-unix-shell/#comment-4</guid>
		<description>bc is great because it supports long numbers (as long as you want) and arbitrary precision (set with scale=100 e.g. for 100 decimal places). It can also do trigonometric math and other stuff, if you load it with the math library (bc -l). But I didn&#039;t know how to use it non-interactively / from shell scripts. Thanks!</description>
		<content:encoded><![CDATA[<p>bc is great because it supports long numbers (as long as you want) and arbitrary precision (set with scale=100 e.g. for 100 decimal places). It can also do trigonometric math and other stuff, if you load it with the math library (bc -l). But I didn&#8217;t know how to use it non-interactively / from shell scripts. Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
