|
Posted by comp.lang.tcl on 12/01/06 17:23
Bryan Oakley wrote:
> 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.
Ok this is what I did:
[TCL]
set contentsList [exec $valPHPPath << $php]; # $valPHPPath IS THE PATH
TO "php"
[/TCL]
And here is the error message I now get:
Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 36)
I even tried a variant:
[TCL]
set contentsList [exec $valPHPPath << '[regsub -all {'} $php {\\'} php;
set php]']
[/TCL]
And got this error message
Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << '[regsub -all {'} $php {\\'} php; set php]'" (procedure
"XML_GET_ALL_ELEMENT_ATTRS" line 36)
And even this:
[TCL]
set contentsList [exec $valPHPPath << '<? print_r("Hello World"); ?>']
[/TCL]
To no avail, getting the following error message:
Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath << '
I am not sure where to go going forward with this at this point, sorry,
you may have to make it a bit more simple for me to understand how to
make this work properly
Phil
[Back to original message]
|