[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrieve output from command

From: Dale P. Smith
Subject: Re: Retrieve output from command
Date: Tue, 31 Jul 2001 12:13:00 -0400

Manuel Giraud wrote:
> I'm trying to get the result of the command "ls" in a list, for
> example :
>         (define l (system->list "ls"))
> I've tried 'system' but it doesn't work since it returns the exit code
> of the command. Maybe, I will be able to do that using port, but maybe
> there's already a library to do such things.

Try something like:

(use-modules (ice-9 popen))

(define foo (open-input-pipe "ls")
(read foo)
(read foo)
(close-pipe foo)

Dale P. Smith
Treasurer, Cleveland Linux Users Group
Senior Systems Consultant, Altus Technologies Corporation
440-746-9000 x309

reply via email to

[Prev in Thread] Current Thread [Next in Thread]