Expect is a neat Tcl extension that provides scripting on Unix for command-line programs, especially interactive ones. This is essentially what I'd like to do (unfortunately from my Windows box) through ssh, although it would be great to be able to do it on Windows as well.
Turns out Windows just basically doesn't permit this, so Windows ports don't work. Apparently at all, because Windows treats the console special in some way, and when invoking things in a pipe things don't stay interactive. It's complicated.
But still - the basic idea is quite sound. For really effective sysadmin work, I'd like to put together two ends: first, an "action worksheet" for complex command-line invocations, and second, just such an interactive back-and-forth. If it only works through ssh, then so be it - I've got a Cygwin ssh working fine that could probably do the trick.
[Also, note on using expect in noisy connection environments.]
Oh! Later, I found Net::SSH2::Expect (along with Net::SSH2::SCP and ::SFTP and the fact that Net::SSH2 is itself part of Strawberry, so part of my faith in the CPAN ecosystem was restored this day). [The Monks have some useful sample code. I think maybe SSH2 could use a tutorial.]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment