How can I execute system specific commands and get their response in Clojure? For example, let's assume we're on a Linux machine, how can I call top or free, and get their results for further processing?
How can I execute system specific commands and get their response in Clojure? For example, let's assume we're on a Linux machine, how can I call top or free, and get their results for further processing?
You could use the babashka library to run shell commands in Clojure. An example would be
#!/usr/bin/env bb
(require '[clojure.java.shell :refer [sh]])
(sh "top")