Question

I am a lisp novice using clisp-2.49.

I am trying to write lisp to mimic this fairly simple piece of bash:

for i in $(program-1)
do
  some-logic
  program-2 $i
done | program-3

There are various ways of executing programs 1 and 3 (run-program, make-pipe-io-stream and probably others), all of which evaluate the form and return a stream for me to use. But for program-2, I need to run the program and tell the form to use the stream which I already have opened. I can find no form for this. Have I overlooked something obvious? Is there some subtlety of which I am not aware?

Many thanks, R.

Was it helpful?

Solution

You can use the undocumented function ext::launch and pass it :output pipe-stream.

Alternatively, you can pass the whole shell script as a string to EXT:RUN-SHELL-COMMAND.

However, generally speaking, Lisp is not designed to be a replacement for shell. You would probably be better off by juggling your program-* execution in shell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top