Closed adereth closed 11 years ago
Thanks! Interop is basically anything-goes until #23 is in, however with the existing sh!
you can implement exec like this:
(def exec
(fn (cmd)
(sh! (str "exec " cmd))))
Also, per your earlier IRC message, and as of 20c70fb and cceee79, a function for matching regexes can be implemented like this:
(def re-matches?
(fn (re s)
(sh! (str "[[ '" s "' =~ " re " ]]"))))
(re-matches? "^he.*$" "hello") ;=> t
(re-matches? "^he.*$" "foo") ;=> nil
Thanks! It wasn't clear to me that I could just use bash syntax in the arguments to sh!
... I'm just so conditioned to not being able to use even simple bashisms when creating commands to be construct a Process on the JVM that it didn't even occur to me.
Glad to help. sh!
maybe isn't properly named - it's closer to ClojureScript's js*
in operation in that its argument is evaluated by bash and not necessarily shelled to.
I'm trying to port a few bash scripts to gherkin. I've got a few that exec at the end and I couldn't come up with a way of doing it besides adding a primitive function.