running interactive program from shell script
Jay Moore
jaymo at cromagnon.cullmail.com
Sun Jan 30 03:35:29 PST 2005
I need a shell script that initiates a telnet session to another host. I have
come up with the following, but unfortunately it terminates when the script
is finished. What I wanted was for the telnet session to remain "alive" and
interactive until manually terminated.
Is there a way to accomplish this in a shell script?
I've been told that I'll have to use "expect" or similar to accomplish this,
but it seems to me that I should be able to do this using just Bourne shell
commands.
#! /bin/sh
(sleep 3;
echo "password";
sleep 3;
echo "ls -la";
sleep 3;
) | telnet -l user 192.168.0.2
Thanks,
Jay
More information about the freebsd-questions
mailing list