(Arne Babenhauserheide)
2015-09-24: add sh example add sh example
diff --git a/examples/sh.w b/examples/sh.w new file mode 100755 --- /dev/null +++ b/examples/sh.w @@ -0,0 +1,25 @@ +#!/usr/bin/env sh +# -*- wisp -*- +exec guile -L $(dirname $(dirname $(realpath "$0"))) --language=wisp -e '(@@ (examples sh) main)' -s "$0" "$@" +; !# + +;; simplest way to run shell commands + +define-module : examples sh + . #:export : sh + +use-modules : srfi srfi-1 + +define : ->string thing + if : symbol? thing + symbol->string thing + format #f "\"~A\"" thing + +define : run-me . args + system : string-join : map ->string args + +define-syntax-rule : sh args ... + apply run-me : quote : args ... + +define : main args + sh echo foo | sed s/o/u/