Add '-n' support to echo

* geesh/built-ins/echo.scm (echo): Omit trailing newline when '-n' is
the first argument.
This commit is contained in:
Timothy Sample 2018-07-18 22:05:57 -04:00
parent a6ceb8f3f2
commit 00d50fe7fd
1 changed files with 5 additions and 2 deletions

View File

@ -26,5 +26,8 @@
;;; Code:
(define (echo env . args)
(display (string-join args " "))
(newline))
(let* ((n? (and (pair? args) (string=? (car args) "-n")))
(args (if n? (cdr args) args)))
(display (string-join args " "))
(unless n?
(newline))))