Re: easy way to add a bunch of numbers in a script

From: Bill Verzal (Bill_Verzal@BCBSIL.COM)
Date: Fri Oct 18 2002 - 15:42:00 EDT


# x=1
# c=`expr $x + 2`
# echo $c
3

Use a "for" loop.
--------------------------------------------------------------------------------------------------------

Bill Verzal
Technical Consultant
Forbes Technical Consulting
(312) 653-3684
bill_verzal@bcbsil.com
MailStop: 27.202B

                    "Michelle
                    DeVault" To: aix-l@Princeton.EDU
                    <adsmigmo@YAHO cc:
                    O.COM> Subject: easy way to add a bunch of numbers in a script
                    Sent by: "IBM
                    AIX Discussion
                    List"
                    <aix-l@Princet
                    on.EDU>

                    10/18/2002
                    02:31 PM
                    Please respond
                    to "IBM AIX
                    Discussion
                    List"

I have a column of numbers (either in a variable or
written to a file) that I need to total in a script.
What's the preferred way to do this?

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:16 EDT