Fork me on GitHub
#babashka
<
2022-10-28
>
Daniel Gerson11:10:55

Question: Is there a way to (shell "echo 'blah'") to pipe the output from here into a subsequent command in a bb script? Or do I need to proc and connect to :in/:out (which ever one is the right one)?

borkdude11:10:22

You can use (-> (process "echo 'blah') (process "cat" {:inherit true}))

borkdude11:10:24

Improved version:

user=> (require '[babashka.process :refer [process]])
nil
user=> (do (-> (process "echo 'blah'") (process "cat" {:out :inherit})) nil)
nil
user=> blah

borkdude11:10:11

If you want to do it manually you can indeed use {:out :string} , capture the string of the processs and the put it as :in ... into the next call