Date: Sun, 30 Jan 2005 05:33:51 -0600 From: Jay Moore <jaymo@cromagnon.cullmail.com> To: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: running interactive program from shell script Message-ID: <200501300533.51350.jaymo@cromagnon.cullmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501300533.51350.jaymo>