Add command substitution support

* geesh/eval.scm (eval-word): Parameterize 'eval-cmd-sub' so that the
word module can substitute commands.
This commit is contained in:
Timothy Sample 2018-07-18 15:45:05 -04:00
parent 6b6ca11bce
commit a6ceb8f3f2
1 changed files with 5 additions and 2 deletions

View File

@ -32,8 +32,11 @@
;;; Code:
(define* (eval-word env word #:key (split? #t) (rhs-tildes? #f))
;; FIXME: Set the 'eval-cmd-sub' parameter.
(expand-word env word #:split? split? #:rhs-tildes? rhs-tildes?))
(parameterize ((eval-cmd-sub (lambda (exps)
(sh:substitute-command env
(lambda ()
(for-each (cut eval-sh env <>) exps))))))
(expand-word env word #:split? split? #:rhs-tildes? rhs-tildes?)))
(define (eval-redir env redir)
"Evaluate the redirect @var{redir} in environment @var{env}."