Forum OpenACS Development: Re: command line calls

3: Re: command line calls (response to 1)
Posted by Andrew Piskorski on
From Tcl you need to use either exec, or open with a command pipeline (e.g., '[open "|ls -l"]'). Depending on exactly what you want to accomplich, one or the other may work better for you. Typically you want exec.

If the command line want to use is dynamically constructed or otherwise complicated, you may also want to use eval in constructing it. But it's either exec or open that you need to do the actual work of running the executable.

If you're new to Tcl, there are some subtleties to making best use of exec, open, and eval that will not be obvious or even clear to you at first (e.g., using a catch around programs that write to stdout, or dynamic construction of command lines), but basic use of exec is simple and straightforward.