|
Posted by Bryan Oakley on 12/01/06 17:02
comp.lang.tcl wrote:
> [TCL]
>
> set php {<? print_r("Hello World"); ?>}
> puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
> puts [exec "echo '$php' | php -q"]
>
> [/TCL]
>
> When I try this within TCL I get the following error:
>
> [quote]
> echo "": No such file or directory
> [/quote]
>
"echo" is not a command you can exec. It is a "built-in" -- a command
known only to the shell that implements it. Think of it more as a
subcommand of sh/bash/ash/tcsh/etc. Much like those commands don't know
about "proc".
You need to understand that 'exec' simply runs a file given to it as the
first argument. It does a couple of shortcuts such as looking for the
file within the directories in the PATH environment variable, and will
look for both "foo.exe" and "foo" on windows. But the fact remains, it
is a way to spawn the execution of a file rather than a command line.
If you're wanting to exec php and give it the contents of a variable on
stdin, try this:
puts [exec php << $php]
You need to make sure that "php" is a valid command file on your
machine, and that its location is in your PATH environment variable.
Navigation:
[Reply to this message]
|