<div dir="ltr">Thank you<div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">:-)~MIKE~(-:</div></div>
<br><div class="gmail_quote">On Mon, Mar 2, 2015 at 7:27 PM, Bryan O'Neal <span dir="ltr"><<a href="mailto:Bryan.ONeal@theonealandassociates.com" target="_blank">Bryan.ONeal@theonealandassociates.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can also use let, which may make more sense <div> let "myVar=$myVar+1"</div><div> As for floating point you need something like bc to handle that</div><div> myVar=5.4</div><div> myOtherVar=3.1</div><div> myVar=$(echo "scale=2; ($myVar + 3.14) / $myOtherVar" | bc)<br> echo $myVar</div><div>If ran the above would print 2.75</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Mar 2, 2015 at 7:15 PM, der.hans <span dir="ltr"><<a href="mailto:PLUGd@lufthans.com" target="_blank">PLUGd@lufthans.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Am 02. Mär, 2015 schwätzte Michael Havens so:<br>
<br>
moin moin Mike,<br>
<br>
see the Arithmetic Expansion portion of the bash man page for details.<br>
<br>
$((expression))<br>
<br>
That says to evaluate the expression and substitute the result. Remember<br>
that the shell only does interger math, no decimals.<br>
<br>
:) ~$ echo $(( 4 / 2 ))<br>
2<br>
:) ~$ echo $(( 4 / 3 ))<br>
1<br>
:) ~$ echo $(( 4 * 3 ))<br>
12<br>
:) ~$<br>
<br>
Note that you don't need to escape the * when using arithmetic expansion<br>
because the $(( )) is already quoting.<br>
<br>
ciao,<br>
<br>
der.hans<div><div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
just starting with this so please, bear with me....<br>
<br>
Anyways I am looking at this beginner's script:<br>
<br>
#! /bin/bash<br>
myvar=0<br>
while [ $myvar -ne 20 ]<br>
do<br>
echo $myvar<br>
myvar=$(( $myvar + 1 ))<br>
done<br>
<br>
Now my mind can wrap itself around everything in this script except for tis<br>
line:<br>
<br>
myvar=$(( $myvar + 1 ))<br>
<br>
Where my difficulty arises is why the '$' before the '(('?<br>
(it was geast fun running that script with a minus sign instead!)<br>
:-)~MIKE~(-:<br>
<br>
</blockquote>
<br></div></div><span><font color="#888888">
-- <br>
# <a href="http://www.LuftHans.com/" target="_blank">http://www.LuftHans.com/</a> <a href="http://www.PhxLinux.org/" target="_blank">http://www.PhxLinux.org/</a><br>
# "The first requisite of a good citizen in this republic of ours is that<br>
# he should be able and willing to pull his weight." -- Theodore Roosevelt</font></span><br></div></div><span class="">---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br></span></blockquote></div><br></div>
<br>---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br></blockquote></div><br></div>