in reply to Exec Fork Trick

It's been a while since I've seen the exact explination for this, so I may not have it exactly right. Basically on most Unix systems, commands like passwd (which require paranoid security) do a little black magic and read their input directly from the tty not from STDIN. Purposely preventing exactly what you're trying to do.

What you could do is write a small wrapper script in a language called 'Expect'. Expect was written to emulate the behavior of a person at the keyboard. This is a technique I have used.

I would suggest trying http://www.cpan.org/modules/by-module/Expect/Expect-1.11.tar.gz first. I've never used it, so I can't say for sure if it will work.

/\/\averick