gusl: (Default)
[personal profile] gusl
(run-program "/bin/sh" '("ls"))
source: 1

Now I just have to figure out how to get the output into Lisp.


(sb-ext:run-program "/bin/ls" '() :output *standard-output*)


will print the contents of the current directory into my SBCL shell, but it still returns # < SB-IMPL::PROCESS 28608 :EXITED > .

Since this stuff is implementation-specific, I don't know the right place to search for documentation.


A-ha!
(with-output-to-string (s) (sb-ext:run-program "/bin/ls" '() :output s))

returns the output of ls! Exactly what I wanted!

Now I just need the Lisp equivalent of Perl's split();

Re: split-sequence

Date: 2006-05-09 02:27 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
I can do almost anything with 'command-output'. One thing I cannot do is CDing. For that, I need 'chdir'. Any idea why?

chdir

Date: 2006-05-10 03:36 pm (UTC)
From: [identity profile] fare.livejournal.com
There is no standard, portable chdir in ANSI CL. The rough equivalent of the current directory is (truename *default-pathname-defaults*).

Every common-lisp implementation has its own chdir, though, and there probably exist abstraction packages that provide it on multiple platforms. Check the Cliki, ask on #lisp.

Profile

gusl: (Default)
gusl

December 2016

S M T W T F S
    123
45678910
11121314151617
18 192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags