From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1712 invoked from network); 14 Jun 1998 00:27:58 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 14 Jun 1998 00:27:58 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id UAA23314; Sat, 13 Jun 1998 20:22:00 -0400 (EDT) Resent-Date: Sat, 13 Jun 1998 20:20:11 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980613172058.ZM28450@candle.brasslantern.com> Date: Sat, 13 Jun 1998 17:20:57 -0700 In-Reply-To: <19980613211233.A5224@math.fu-berlin.de> Comments: In reply to Sven Guckes "Re: lssum - summing up sizes of files" (Jun 13, 9:12pm) References: <19980613181013.A4302@math.fu-berlin.de> <980613100641.ZM27081@candle.brasslantern.com> <19980613211233.A5224@math.fu-berlin.de> <19980613153845.A28197@morel.campusclub.princeton.edu> <19980613235639.B5224@math.fu-berlin.de> In-Reply-To: <19980613235639.B5224@math.fu-berlin.de> Comments: In reply to Sven Guckes "Re: lssum - summing up sizes of files" (Jun 13, 11:56pm) X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Guckes , zsh-users@math.gatech.edu Subject: Re: lssum - summing up sizes of files MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"MH7At.0.Bh5.vSnWr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1612 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jun 13, 9:12pm, Sven Guckes wrote: } Subject: Re: lssum - summing up sizes of files } } Doesn't everybody need this kind of thing every day? I've been using unix for almost fourteen years now (gaah) and I can count the times I've *needed* that on one hand. There were a few more times when I was just curious, but then "wc -c * | tail -1" seemed adequate. } > stat -A sizes +size $* } } Looks cool! We have zsh-3.1.2 here - will that version work? I think the stat module is available for 3.1.2. } Or is are "modules" a new feature of zsh-3.1.4? No, but they're not in 3.0. } How do you "load" those modules, anyway? They're either built in, or if zsh was compiled for dynamic loading, then you use the "zmodload" command. "zmodload" works a lot like "autoload", but searches $MODULE_PATH for a shared library (.so) named for the module. On Jun 13, 11:56pm, Sven Guckes wrote: } Subject: Re: lssum - summing up sizes of files } } Sure, but - if the zsh has to do globbing anyway } then why not have it looks at the files, too? Most globbing can be done by reading the directory structure. Looking at the files too is much more expensive. } As there is a GLOBBING modifier for "size" File-statistics glob qualifiers (modifiers are qualifiers that change the string that is returned after the glob succeeds) are used only to eliminate a file after all the fast pattern matching on its name has succeeded. } there must be a nice way to extract the size of files somehow. That's what the "stat" module is for. An interesting alternative to the "stat" module would be a glob modifier that replaces the file name with one of its statistics. E.g. echo *(D:#G) might echo the group-ids of every file in the current directory (:#L for the size, :#m for the mod time, etc.). I don't plan to hold my breath expecting someone to implement this, though. } Would be nice if there was an easy way to get the sum } without writing an explicit loop for this, too. That's an awfully special special-case. Is there some kind of general loop replacement that you're thinking of? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com