in reply to Re^2: Automating command line utility
in thread Automating command line utility

one can simple open /dev/tty and read from it

I don't think so, opening /dev/tty is useful, for instance, when you want to ask the user for a password and don't want it comming from stdin, but the OP seems to be automating some program that asks for login/passwd probably via its /dev/tty and that's what Expect is for.

Under the hood, Expect creates a pair of master/slave pseudo ttys (via IO::Pty), forks a new process and sets /dev/tty on the child to be the slave pseudo tty. Then the parent process, through the master pty, can read and write to the child /dev/tty.