Re: a small SBCL question



dneu@xxxxxxx writes:

Pascal Bourguignon wrote:

S/CL-USER[39]> (with-open-stream (files
(sb-ext:process-output
(sb-ext:run-program "/bin/ls" '("-l" "/tmp/a.lisp")
:output :stream)))
(loop :for line = (read-line files nil nil)
:while line :do (princ line) (terpri)))
-rw-r--r-- 1 pjb pjb 93 2006-12-13 21:21 /tmp/a.lisp
NIL


I tried the example above, with a wildcard, i.e. "/tmp/*.lisp" instead
of "/tmp/a.lisp",
and no files were found, and there are files matching the pattern.

Could someone explain why?

Yes. Anybody with the most basic understanding of unix shells.

In:

ls *.lisp

it's the shell that expands the wildcard, not the /bin/ls command.


If you want to implement a similar feature in lisp, you'd have to use
DIRECTORY:

(sb-ext:run-program "/bin/ls" (cons "-l" (directory "/tmp/*.lisp"))
:output :stream)


--
__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
.