bourne shell query
George Turczynski
george at hls0.hls.oz
Wed Sep 5 16:00:42 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?)
I don't know whose UNIX you have but you may have a utility called
"dc", for "desk calulator". If you have it, read the man page. It
will handle numbers > 1000 AND numbers with decimal fractions.
for example:
|>---------Cut here----------<|
#! /bin/sh
num="10000.0"
while [ $num != "10010.0" ];
do
num=`echo "$num 0.2 + p" | dc`
echo $num
done
|>---------Cut here----------<|
Just another idea...
--
| George P. J. Turczynski. |----------------------------------------------------
| Computer Systems Engineer. | ACSnet: george at highland.oz | I can't speak for the |
| Highland Logic Pty. Ltd. | Phone: +61 48 683490 | company, I can barely |
| Suite 1, 348-354 Argyle St | Fax: +61 48 683474 | speak for myself... |
| Moss Vale. NSW. Australia. 2577 |----------------------------------------------------
More information about the Comp.unix.shell
mailing list