non-interactive scripting

Darryl Moore darryl-90a536wCiRb3fQ9qLvQP4Q at
Tue Sep 29 16:51:46 UTC 2009

Cool, thanks. I'd never heard of expect before, but now I've found more
information on it here:

This is all good info to know.


Brandon Sandrowicz wrote:
> On Mon, Sep 28, 2009 at 2:36 PM, Darryl Moore <darryl-90a536wCiRb3fQ9qLvQP4Q at> wrote:
>> 3) Why cannot I not accomplish the same thing by not using --batch and
>> simply piping the answers to prompted questions in the same manor as
>> above? I've tried. It doesn't work. I still get the prompts as if there
>> never was any stdin redirect.
> gpg is probably like ssh in that it read/writes directly to the
> terminal device rather than stdin/stdout.  That's why you need to use
> something like expect or pexpect (python version) to script running
> ssh (with a password prompt, that is) because it emulates a terminal.
> Basically any program that looks like it's just doing stdin/stdout but
> does things like masking your password when you type it in (or just
> not showing any characters at all) is hooked directly into the
> terminal device. I'm sure others here are more versed in the specifics
> of TTYs and PseudoTTYs.  Reading/writing directly to the terminal
> device is supposed to be more secure though other than password
> masking I'm not sure why.
> I remember there being a brief blurb about this in pexpect (which is
> where I first picked up this knowledge, IIRC).
> When you use the --batch switch you're telling it that you're going to
> be using redirection so it needs to use stdin/stdout.
The Toronto Linux Users Group.      Meetings:
TLUG requests: Linux topics, No HTML, wrap text below 80 columns

More information about the Legacy mailing list