Re: Is there a way to make 'wish' read standard input?




tclin1998@xxxxxxxxx schrieb:
### tt.tcl begin
set a 123
puts $a
### end

On Linux console, I type in
wish tt.tcl
I'll see a window pop up, and the console shows

northstar:/tmp% wish tt.tcl
123
_

However,
I could not get the command prompt % in the console.
Is there a way to get tcl command prompt % in the above scenario ?

Easy - pedestrianly: at the end of your script, add:

while 1 {
puts -nonewline "% "; flush stdout
gets stdin line
catch $line res
puts $res
}

.



Relevant Pages

  • Re: Interactive debugging
    ... command, then you're in debug mode in the console, and you ... type continue to re-enter the script where you left off. ... in the debugger/console you're at the scope where the keyboard() call ... The line where the set_traceis invoked puts you back in the interpreter. ...
    (comp.lang.python)
  • Re: counter
    ... puts or print or p? ... will work under every environment. ... Under Unix you can print the character \r to go back to the beginning of the line, but keep in mind that stdout is line buffered: by default, it prints its output just when a line break is found. ... Anyway, even if it won't work on a specific console, the user will be able to understand its output anyway, so it shouldn't be a big issue. ...
    (comp.lang.ruby)
  • Re: Redirecting standard output
    ... Is there a way to redirect the standard output, so that command like ... puts write to a file instead of the console? ...
    (comp.lang.ruby)
  • Redirect gets to get input from a file insted of from the us
    ... I only now how to do this by running the program from the console ... I am new to ruby, and new to this kind of programming, so please don't ...
    (comp.lang.ruby)
  • Re: console show gone on Win98 ?
    ... >and it brings up a console screen. ... The first 'puts' appears in the "DOS" console, then the console window ...
    (comp.lang.tcl)