On this page:
shell
shell/  wait
build-shell
shell-subst

4.4 Shell Commands🔗ℹ

The zuo/shell module is reprovided by zuo.

procedure

(shell command ... [options])  hash?

  command : string-tree?
  options : hash? = (hash)
Like process, but runs the combination of command strings as a shell command (via /bin/sh on Unix or cmd.exe on Windows).

The command strings are combined into a single command string in the same as by build-shell. Spaces in a command are left as-is; so, for example, "ls -a" as a sole command string is the same as a sequence "ls" then "-a". Use string->shell to protect characters like spaces, and especially to convert from a path (that might have spaces or other special characters) to part of a command.

procedure

(shell/wait command ... [options])  void?

  command : string-tree?
  options : hash? = (hash)
Like shell, but first displaylns the command string, uses thread-process-wait (or process-wait if options has a true value for 'no-thread?) to wait on the shell process, and reports an error if the process has a non-0 exit code.

If options includes 'quiet? mapped to a true value, then command is not shown using displayln. If options includes 'desc mapped to a string value, the string is used in place of "shell command" when reporting an error. Any 'quiet?, 'no-thread?, or 'desc mapping is removed from options before passing it on to process.

procedure

(build-shell shell-strs ...)  string?

  shell-strs : string-tree?
Appends the flattened shell-strs sequence with separating spaces to form a larger shell-command sequence. An empty-string among shell-strs is dropped, instead of creating extra spaces.

Note that build-shell does not attempt to protect any of the shell-strs as a literal. Use string->shell to convert an individual path or literal string to a shell-command argument encoding that string.

procedure

(shell-subst str vars)  string?

  str : string?
  vars : hash?
Expands str by replacing ${name} with the value that the symbol form of name is mapped to in vars, where name can contain any character except }. After a replacement, the string is scanned again for further substitutions. An error is reported if a reference name has no value in vars.