How to pipe a tcl command within bash or zsh shell? -


basically trying pipe tcl command within zsh shell. common piping grep, awk , sed text manipulation.

with perl , ruby there -e option allows execute statements directly shell without writing script on file.

is possible achieve same thing in tcl?

thank you.

tclsh not have -e; it's simple wrapper round tcl library.

you can simulate script this:

apply {{} {     global argv0 argv argc     if {[lindex $argv 0] eq "-e"} {         set script [lindex $argv 1]         set argv [lrange $argv 2 end]         incr argc -2         uplevel #0 $script     } else {         set argv0 [lindex $argv 0]         set argv [lrange $argv 1 end]         incr argc -1         uplevel #0 [list source $argv0]     } }} 

if make script in called tclhelper.tcl , define shell alias:

alias tcl='tclsh tclhelper.tcl' 

then you'll able do:

tcl -e "puts [info patchlevel]" 

and see things work.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -