Prev: How to reorder DOM nodes in tdom?
Next: Wiki changes
From: ferdinand dellona on 23 Feb 2010 16:52 Hi, I want to run a TCL script by passing the script file as I invoke tclsh, but let it stay interactively: % tclsh script.tcl Does someone out there know how to do this? Thanks, -deejay
From: nedbrek on 23 Feb 2010 18:40 Hello all, "ferdinand dellona" <fdellona(a)gmail.com> wrote in message news:8afaaf66-2721-487d-bc6e-e99e1bd951e7(a)z1g2000prc.googlegroups.com... > > I want to run a TCL script by passing the script file as I invoke > tclsh, but let it stay interactively: > > % tclsh script.tcl > > Does someone out there know how to do this? There is probably a better way, but I just use: % tclsh $ source script.tcl Ned
From: suchenwi on 24 Feb 2010 10:07 On 24 Feb., 00:40, "nedbrek" <nedb...(a)yahoo.com> wrote: > > I want to run a TCL script by passing the script file as I invoke > > tclsh, but let it stay interactively: > > > % tclsh script.tcl > > > Does someone out there know how to do this? > > There is probably a better way, but I just use: > % tclsh > $ source script.tcl A simple way is to add, at the end of script.tcl, a read-eval-print loop: while 1 { puts -nonewline "% "; flush stdout gets stdin line catch $line res puts $res } Though seemingly endless, you can leave the loop with e.g. "exit" :^)
From: Alexandre Ferrieux on 24 Feb 2010 10:36 On Feb 24, 4:07 pm, suchenwi <richard.suchenwirth- bauersa...(a)siemens.com> wrote: > On 24 Feb., 00:40, "nedbrek" <nedb...(a)yahoo.com> wrote: > > > > I want to run a TCL script by passing the script file as I invoke > > > tclsh, but let it stay interactively: > > > > % tclsh script.tcl > > > > Does someone out there know how to do this? > > > There is probably a better way, but I just use: > > % tclsh > > $ source script.tcl > > A simple way is to add, at the end of script.tcl, a read-eval-print > loop: > > while 1 { > puts -nonewline "% "; flush stdout > gets stdin line > catch $line res > puts $res > > } > > Though seemingly endless, you can leave the loop with e.g. "exit" :^) 'while {[gets stdin line]>=0}' will avoid busylooping on EOF ;-) Also, a cleaner way is to have in your .tclshrc: if {[info exists ::env(PRESCRIPT)]} { puts stderr "(loading $::env(PRESCRIPT))" source $::env(PRESCRIPT) } And then, when you want script.tcl to be loaded on startup: (sh family) PRESCRIPT=script.tcl tclsh (csh family) env PRESCRIPT=script.tcl tclsh -Alex
From: Tcl Bliss on 24 Feb 2010 15:45 On Feb 23, 1:52 pm, ferdinand dellona <fdell...(a)gmail.com> wrote: > Hi, > > I want to run a TCL script by passing the script file as I invoke > tclsh, but let it stay interactively: > > % tclsh script.tcl > > Does someone out there know how to do this? > > Thanks, > > -deejay My personal favorite is (add at the end of your script): package require Tclx; commandloop -async; vwait forever;
|
Pages: 1 Prev: How to reorder DOM nodes in tdom? Next: Wiki changes |