Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!silma!aab From: aab@silma.com (Andy Burgess) Newsgroups: comp.unix.questions Subject: What's wrong with this Bourne shell script? Message-ID: <1990Aug3.193231.3166@silma.com> Date: 3 Aug 90 19:32:31 GMT Reply-To: aab@silma.UUCP (Andy Burgess) Organization: Silma, Inc. Cupertino CA Lines: 25 On SunOS 4.03c this script: ----------------------- cut here -------------- : total=0 ls -ld * | while read line do set - `echo $line` total=`expr $total + $4` echo "Subtotal $total" done echo "Total $total" ----------------------- cut here -------------- The subtotal prints increasing numbers as you would expect. At the end total prints as 0! What gives? While you're at it, is there a better way to get the total bytes of the files in a directory? Thanks Andy Burgess