next up previous contents index
Next: Other Side Effecting Functions Up: Functions with Side Effects Previous: Plotting Functions

Shell Commands

The functions in this section can be used to execute shell commands from within Nesl.

shell_command(name, input) {([char], [char]) tex2html_wrap_inline10767 [char]}
  Executes the shell command given by name. If the second argument is not the empty string, then it is passed to the shell command as standard input. The shell_command function returns its standard output as a string. For example, the command shell_command("cat","dog") would return "dog".

get_environment_variable(name) {[char] tex2html_wrap_inline10769 [char]}
  Gets the value of an environment variable. Will return the empty string if there is no such variable.

spawn(command, stdin, stdout, stderr)
{([char], stream, stream, stream) tex2html_wrap_inline10771 ((stream, stream, stream), bool, [char])}
  Creates a subprocess (using unix fork). The spawn function takes 4 arguments:

The function returns three file descriptors a boolean status flag and an error message: ((stdin, stdout, stderr), (flag, message)). For any non null stream passed to spawn, spawn will return the same stream and use that stream as stdin, stdout or stderr. If the null stream is passed for any of the three stream arguments, then spawn will create a new stream and pass back a pointer to it.



Jonathan Hardwick
Tue Nov 28 13:57:00 EST 1995