3 ms·
Can it integrate with Unix command-line filters and tools roughly as well as shell can? Interested.
by vram22 10y ago
Can it integrate with Unix command-line filters and tools roughly as well as shell can? Interested.
- pwg 10y agoThat depends upon your definition of "integrate". It can read/write stdin/stdout (just as any scripting language can) so it can be used to write additional filters/tools that don't exist in the standard set that can then be used from shell as with any other tool. But if you mean using it to create a pipeline out of existing command line tools, then yes, but with a bit more boilerplate than plain shell needs. The built in "exec" command has an almost shell syntax for starting pipelines, and the "open" command supports the same syntax, so it is 98% "as well" in that regard. But to avoid getting stuck in a deadlock trying to write data to a pipeline that is returning filtered data to the script requires turning on Tcl's event driven file IO, which is where the extra boilerplate comes from.
- vram22 10y ago>That depends upon your definition of "integrate". I meant roughly all that can be done with shell, except maybe somewhat differently (due to Tcl's different syntax or features). The usual things: call existing command-line tools, write scripts in which you use its own syntax/features as well as call / pipe between / orchestrate command line tools, redirect std I/O, etc. - the things that make the shell powerful. Thanks for the reply. Seems like it is close to equivalent from what you say.
- ArkyBeagle 10y agoUh.... yes. At least Tcl can; I haven't used expect in years. The subject is "tcl pipes".
- vram22 10y agoDid a search for that subject: https://www.google.com/search?q=tcl+pipes https://www.google.com/search?q=tcl+pipes and this second result was interesting: http://wiki.tcl.tk/17419 http://wiki.tcl.tk/17419 It compares doing the same task (getting a part of a string from the last line of a text file) in Tcl and Python. Seems to conclude that some things are easier in Tcl and some in Python (based on a quick read).