From: Olin Shivers <email@example.com>
Subject: Re: taking stdout from a (run (progname))?
Date: 28 Jun 2001 22:43:58 -0400
Organization: College of Computing, Georgia Tech
Martin Gasbichler wrote:
> >>>>> "Steve" == Steve Wray <firstname.lastname@example.org> writes:
> Steve> In perl (yuck) I can run a program and take stdout from it and use
> Steve> that in the rest of the script.
> Steve> maybe like
> Steve> (map (du) (run (ls))
> Steve> which would run du on each file returned by ls...
> Steve> (assuming map works in this thing... mapcar or something maybe?)
> Steve> I'd love to give perl (yuck) the boot...
> Steve> I just printed out the scsh docco and am hopeful...
> Steve> I thought I'd post this Q here to see what useful info you
> Steve> peeps might come up with!
> So, try
> (map (lambda (file) (run/strings (du ,file))) (run/strings (ls)))
(run/string (du ,@(run/strings (ls))))
if it's acceptable to have all the reports merged into one big string.
But you shouldn't use ls to generate lists of filenames. Suppose a filename
contained a newline character? And why pay the overhead of running a whole
process just to grab the names of the files in a dir? This is faster *and*
(run/string (du ,@(directory-files)))
Don't run a whole process when you can just call a Scheme function...
I am way behind on scsh posts; will try to catch up this week.