bourne shell query

Matt Day mday at iconsys
Sun Sep 2 09:44:10 AEST 1990


In article <SCOTT.90Aug30124930 at tab00.larc.nasa.gov> scott at tab00.larc.nasa.gov (Scott Yelich) writes:
>As a side question, does ANYONE have any bourne shell routines which do
>math... reasonably effeciently?  (For numbers > 1000?)

For the Bourne shell, the most efficient way to do math is to use the "expr"
program.  It doesn't support floating point, but it doesn't have any trouble
with numbers larger than 1000.  If you have a shell script that needs to do
a lot of math, I suggest you use the C shell built in math operators; it's
much faster (or perl, of course).
-- 
- Matthew T. Day, Sanyo/ICON, mday at iconsys.icon.com || uunet!iconsys!mday



More information about the Comp.unix.shell mailing list