in reply to Re: How to input STDIN
in thread How to input STDIN
Expect is overkill for this. Expect need only be used when there is interactice input AND output (you need to send something, wait for something, send something else...) or when the application is actually insisting that the input come from a tty. If the application will accept input on STDIN and all you want to do is feed it, you just need a pipe instead of system:
open(EXTERNAL, "|your-command-goes-here with-its-arguments") or die; print EXTERNAL "The external program will receive this on STDIN\n"; close EXTERNAL;
Some external commands ignore STDIN and go straight to the controlling tty to get their input because they want to guarantee that it comes from a user, not another program. passwd is typically one of them. That's when you need Expect.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to input STDIN
by Anonymous Monk on Dec 15, 2005 at 13:22 UTC |