Lisp and shell commands
Apr. 25th, 2006 06:24 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
(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()
;
split-sequence
Date: 2006-04-26 01:43 am (UTC)Re: split-sequence
Date: 2006-05-09 02:27 pm (UTC)chdir
Date: 2006-05-10 03:36 pm (UTC)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.