[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dc and bc in Important?



On Jun 28, Carey Evans wrote
> andersee@et.byu.edu (Erik B. Andersen) writes:
> 
> [snip]
> 
> > For most math, expr works just fine.  Of course, expr is limited
> > to integer math, but it works and is portable.
> 
> Actually, for integer math, bash or ksh works quite well.
> 
> bash$ a=41
> bash$ let a+=1
> bash$ echo $a
> 42
> 
> -- 
>                 Carey Evans  <*>  c.evans@clear.net.nz
> 

iThis is correct, but has the unfortunate side effect of not being portable, 
since not all /bin/sh happin to be bash.  If you want to allow the program
to run on non-Linux machines, or machines running ash, etc. then expr
is the most portable way.  If you don't care about using bash-isms, which
is often the case for Debian, then what you describe above is much easier.

 -Erik

--
Erik B. Andersen   Web:    http://www.inconnect.com/~andersen/ 
                   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: