Subject: [clisp-list] returns from shell commands

From: "Jacques B. Siboni" <[email-masked]>
Date: Thu Jun 24 09:43:21 2004

Hi all

when I run 
[17]> (setq foo (shell '|ls *.kb|))

I get:
dsm3.kb
0

[18]> foo
0

foo has a value of 0

Can someone tell me how to get the return of my shell  command into a lisp
variable?

Thanks in advance

Jacques

-- 
Dr. Jacques B. Siboni mailto:[email-masked]
8 pass. Charles Albert, F75018 Paris, France
Tel. & Fax: 33 (0) 1 42 28 76 78
Home Page: http://www.lutecium.org/jacsib/

---

From: Sam Steingold <[email-masked]>
Date: Thu Jun 24 11:28:33 2004

> * Jacques B. Siboni <[email-masked]> [2004-06-24 16:41:23 +0000]:
>
> when I run 

printed by ls

returned EXT:SHELL

> Can someone tell me how to get the return of my shell command into a
> lisp variable?

try

(with-open-stream (s (run-program "ls" :arguments '("-l") :output :stream))
  (loop :for l = (read-line s nil nil) :while l collect l))

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Any programming language is at its best before it is implemented and used.

---

From: "Jacques B. Siboni" <[email-masked]>
Date: Thu Jun 24 11:39:21 2004

>   (loop :for l = (read-line s nil nil) :while l collect l))

Sam,

Thanks

It s wonderful with this

Thanks again

Jacques

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Thu Jun 24 11:55:21 2004

> Can someone tell me how to get the return of my shell  command into a lisp

Read more of clisp documentation!
http://clisp.cons.org/impnotes/shell.html

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein