set exebase [file rootname [file tail [info nameofexecutable]]] puts stdout "------------------------" puts stdout "message from script" puts stdout "exebase : $exebase" puts stdout "::tcl_interactive : $::tcl_interactive" puts stdout "::tclsh(istty) : $::tclsh(istty)" puts stdout "------------------------" #optionally read part or all of stdin, #but we don't know how to put data back into stdin - so partial read should only be done if there is a protocol for the data to be read and processed. #set inputdata [read stdin] if {"-noeval" ni $::argv} { set ::tclsh(evalinput) 1 } else { if {"-eat2" in $::argv} { set eat [read stdin 2] puts stdout "stdin read: [string length $eat] bytes" puts stdout $eat puts stdout "info exist ::tclsh(inputbuffer): [info exists ::tclsh(inputbuffer)]" } #set ::tclsh(evalinput) 0 } #now that we have set the evalinput flag for PIPEREPL - when we exit this script - the piperepl will read from stdin and evaluate any remaining input as tcl code. #This means that no matter what we do with ::tclsh(dorepl) - it could be overridden by the script on the input. that's ok. if {"-dorepl" in $::argv} { set ::tclsh(dorepl) 1 }