문제

I would like to write a shell script to start a lein repl and then provide some commands while still keeping the repl running.

For example I might want to do the equivalent of:

lein repl
(dev)
(setup)

I can pipe to the repl by echo "(dev)\n(setup)" | lein repl but the repl terminates afterwards.

Is there a way to get around this or another means of starting a repl and issuing commands from a shell script?

도움이 되었습니까?

해결책

(echo "(println :hello)"; cat <&0) | lein repl

This prints the command - letting the REPL process it -, then "switches back" to stdin for input. You might have to interrupt the cat call after leaving the REPL, though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top