What's wrong with this Bourne shell script?

Chip Rosenthal chip at chinacat.Unicom.COM
Mon Aug 13 06:47:33 AEST 1990


In article <9116 at jpl-devvax.JPL.NASA.GOV>
	lwall at jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>In article <850 at jonlab.UUCP> jon at jonlab.UUCP (Jon H. LaBadie) writes:
>: 	ls -ld | addcol -4
>: [or]
>: 	TOTAL=`cat * | wc -c`
>[ls messes up on non-regular files; cat is inefficient]

If you snarfed the "stat" program I posted to alt.sources recently,
I'd suggest:

    echo 0`stat -s * | sed -e 's/.*:/+/'` | bc

or if you have Jon's addcol, even simpler:

    stat -s * | addcol -2

-- 
Chip Rosenthal                            |  You aren't some icon carved out
chip at chinacat.Unicom.COM                  |  of soap, sent down here to clean
Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt



More information about the Comp.unix.questions mailing list