stty echo in ash

Rob Landley rob at landley.net
Thu Aug 3 17:13:01 UTC 2006


On Wednesday 02 August 2006 12:09 pm, Rich Felker wrote:
> Well, I would maybe use it for controlling a modem dial procedure or
> old-style isp login or such, but I can't imagine using expect to
> interact with a real shell.

There seem to be a number of things you can't imagine.

For TimeSys, I wrote my own python version of expect that drives gdb to test 
out gdbserver cross-compiled for a non-x86 machine.  Shell scripts don't 
descend into the tools you call from the shell.  You can fake some things 
like "fdisk" with here documents (I've done this too), but that doesn't help 
if you need to query data from the tool to provide further input in the same 
invocation of the tool.

Here's a script I wrote a while back to interactively drive the "mail" command 
on the remote end to marshall my new mail from /var to /home so I can copy my 
down my mail from a server without worrying about locking against new mail 
in /var/spool:

  http://landley.net/code/filchmail

It doesn't use expect but only because I don't want to mess with tcl and 
hadn't written the python one yet.  (It's bash.)  I keep meaning to fix it up 
so it works with just one ssh invocation (right now it has to ssh _back_ into 
the thing to delete the mail out of the home directory if the download 
worked, because shell scripts don't have circular pipelines.  Which is 
something _else_ I've wanted to implement for years, ever since I first had 
to deal with the Roaring Penguin PPPoE tool a half-dozen years ago, and which 
I plan to add to bbsh.  You can sort of fake it with FIFOs or named pipes, 
but it's more trouble than it's worth.)

> Not that it can't be done, but wouldn't 
> running a script make more sense?

Reality gets complicated.  This is normal.

> Rich

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list