What's wrong with this Bourne shell script?

Randal Schwartz merlyn at iwarp.intel.com
Tue Aug 7 03:22:25 AEST 1990


In article <1990Aug3.193231.3166 at silma.com>, aab at silma (Andy Burgess) writes:
| While you're at it, is there a better way to get the total bytes
| of the files in a directory?

perl -e 'for(@ARGV){$x += (stat($_))[7];} print "$x bytes\n";' *

and soon (after the next patch):

perl -e 'for(@ARGV){$x += -s;} print "$x bytes\n";' *

Just another Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list