Note: This is taken from the Chicken Wiki, where a more recent version could be available.
Convenience macros for running shell commands.
[syntax] (run COMMAND) [syntax] (run < COMMAND) [syntax] (run > THUNK COMMAND)
Runs COMMAND as a shell command using the system(3) library function. COMMAND should be a list where each list-element will be converted to a string and the resulting strings concatenated, separated by a single space character. COMMAND is implicitly quasi-quoted - subexpressions preceded by , or ,@ are evaluated. Sub-lists in the command are flattened and spliced into the result sequence. Quoted sub-expressions are enclosed in single quotes ('...'). Note that the characters ' ( ) { } [ ] , ; ` " | are treated specially by the Scheme reader and thus should be enclosed in double quotes (see the examples section).
If the command exists with a non-zero status code, an exception of the kinds (exn runcmd) is signalled.
If the command is preceded by <, then run returns a string containing the output of the command, with any trailing newline character removed. If the command is preceded by >, then the first argument is evaluated and COMMAND is executed with its standard input replaced by any output written to the value returned by (current-output-port) during execution of the zero argument procedure THUNK:
(run > (cut print "one\ntwo") (tac))
prints
two one
[syntax] (run* COMMAND)
Similar to run, but returns the status code of the shell command (without signalling an exception in case the status is nonzero).
[parameter] run-verbose
If true, then each command executed by run[*] is printed to the port returned by (current-output-port).
[parameter] dry-run
If true, then commands are not executed and treated as executing successfully.
Copyright (c) 2007, Felix L. Winkelmann All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.