summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-12-30 10:42:50 -0500
committerBen Sima <ben@bsima.me>2022-12-30 10:42:50 -0500
commit4dfa9485f958f82624bebea8f60e915eab236430 (patch)
treec24b425bf3a0854598f85ea92e3195056564b4d0
parent0ed300d6f783d3ec860d9657743d66d5ce68463a (diff)
Add #$ reader macro for shell commands
-rw-r--r--bs/shell.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/bs/shell.scm b/bs/shell.scm
index 8dea64f..3a5d276 100644
--- a/bs/shell.scm
+++ b/bs/shell.scm
@@ -30,3 +30,16 @@
(define (cd path)
(chdir path)
(ls))
+
+;; run shell commands with #$"cmd args"
+;; #$"who"
+;; ben tty7 2022-11-07 20:31 (:0)
+(read-hash-extend
+ #\$
+ (lambda (c port)
+ (let ((input (read port)))
+ ;; todo:
+ ;; - parse input for #{interpolations}
+ ;; - evaluate scheme code inside the blocks
+ ;; - then exec this
+ `(exec ,input))))