Re: ?? exec prog << value ??



Zeh Mau wrote:
Ok, I have a file called example.tcl

the file contains the following commands:

-----------------------------------------
set var 4+4\n

puts $var

set result [exec test_prog << $var]

puts $result
-----------------------------------------

The output is:
-----------------------------------------
4+4

syntax error
can't read "result": no such variable
-----------------------------------------
The message "syntax error" is created by
test_prog when there is no mathematical expression.

Thanks for your help,
Zeh Mau


Ok, your tcl code is correct. Your test_prog must have a bug.

Can you run your test_prog from the command line, like the following?

echo '4.4' | test_prog

My guess is, if you run it from the command line you will get the same error.

--
Bryan Oakley
http://www.tclscripting.com
.



Relevant Pages

  • Re: ?? exec prog << value ??
    ... the file contains the following commands: ... puts $result ... The message "syntax error" is created by ...
    (comp.lang.tcl)
  • Re: Using Net Use command...
    ... A syntax error means there's something wrong with the command itself, not the result of the command. ... You can only map a drive to a share, not a folder. ... So I'm on my network, but is there another way to just browse to a directory? ...
    (microsoft.public.windows.server.networking)
  • Re: Re: Ruby/Tk: How to access surrounding class from Tk Callback?
    ... # Do something with @root and @foo ... puts @root.foo # DOES NOT WORK ... @root in your button's command is an instance variable ...
    (comp.lang.ruby)
  • Re: Net::SSH expect like interface
    ... This is something I've been wanting for a long time too, ideally to use ssh ... passing in nil as the command name. ... puts s.cmd ... @channel = connection.open_channel( ...
    (comp.lang.ruby)
  • Re: Use tcl to perform linux commands
    ... command to make to execute in parallel and then log the result into a ... But the results are displayed on the screen (command line) ... chan configure $handle -blocking 0 ... puts "Child was killed with signal $sigName" ...
    (comp.lang.tcl)