Support . script, source script.
This commit is contained in:
parent
726ca052a9
commit
90325b22a2
2
check.sh
2
check.sh
|
@ -64,6 +64,8 @@ tests="
|
|||
40-eval-echo-variable
|
||||
40-assignment-eval-echo
|
||||
|
||||
41-dot.sh
|
||||
|
||||
50-iohere
|
||||
|
||||
60-function
|
||||
|
|
|
@ -362,6 +362,8 @@
|
|||
(('brace-group o) `(brace-group ,(transform o)))
|
||||
(('file-name o) `(file-name ,(transform o)))
|
||||
|
||||
('doublequotes "")
|
||||
|
||||
(_ ast)))
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,13 @@
|
|||
escape-builtin?))
|
||||
(lambda _ (status:exit-val (apply system* command))))))
|
||||
(else (lambda () #t))))
|
||||
(exec (append-map glob args)))
|
||||
(match args
|
||||
(((or "." "source") file-name)
|
||||
(let* ((string (with-input-from-file file-name read-string))
|
||||
(ast (parse-string string)))
|
||||
(run ast)
|
||||
0))
|
||||
(_ (exec (append-map glob args)))))
|
||||
|
||||
(define (glob? pattern)
|
||||
(and (string? pattern) (string-match "\\?|\\*" pattern)))
|
||||
|
@ -342,6 +348,9 @@
|
|||
(if (string-suffix? pattern value) (substring value 0 (string-length pattern))
|
||||
value))))
|
||||
|
||||
(define (number o)
|
||||
o)
|
||||
|
||||
(define (pat o)
|
||||
o)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
. test/data/script.sh
|
||||
echo $foo
|
|
@ -0,0 +1 @@
|
|||
foo=bar
|
Loading…
Reference in New Issue