Hacker News new | past | comments | ask | show | jobs | submit login

Tcl. It works really well as a cross-platform (*nix/Windows) alternative to shell scripting that doesn't suffer from the same problems as the POSIX shell (see http://www.dwheeler.com/essays/fixing-unix-linux-filenames.h...). It builds on the same foundation of everything being text but with a few changes to the substitution rules builds something a lot like a Lisp on top of it.



I found expect (which is Tcl + some extensions, I believe) to be quite useful.

Implementing something like modem initialization - "Send AT command to modem/wait for a reply matching one of several patterns or a timeout/handle result/rinse, lather, repeat until done" - is quite trivial to do with expect.

It's not something I use every day, but it's one of those useful things to keep in your mental toolbox.


Came here to say this. Expect was and remains extremely powerful.

I've been using it for 15 years to automate network configuration deployment. Now that automation is all the rage in the industry it gets dismissed, but I find it is often much better than some of the other tools available.


Can it integrate with Unix command-line filters and tools roughly as well as shell can? Interested.


That 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.


>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.


Uh.... yes. At least Tcl can; I haven't used expect in years.

The subject is "tcl pipes".


Did a search for that subject:

https://www.google.com/search?q=tcl+pipes

and this second result was interesting:

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).


Ditto. It's original purpose as an embedded scripting language for C programs still stands.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: