Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell script 1

Status
Not open for further replies.

sco21

Technical User
May 20, 2002
67
GR
I have a file with some numbers on it.
2
3
4
5
6
7
8
8

How can I add all this numbers and make a sum of them

whith expr ?
how?




thanks
 
sum=0
for xx in `cat filename`
do
sum=`expr $xx + $sum`
done
echo $sum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top