From owner-freebsd-questions@FreeBSD.ORG Sun Jan 30 11:35:29 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59D0316A4CE for ; Sun, 30 Jan 2005 11:35:29 +0000 (GMT) Received: from cromagnon.cullmail.com (cromagnon.cullmail.com [67.33.58.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id E91D043D31 for ; Sun, 30 Jan 2005 11:35:28 +0000 (GMT) (envelope-from jamoore@cromagnon.cullmail.com) Received: from cromagnon.cullmail.com (localhost.cullmail.com [127.0.0.1]) j0UBXqxY008099 for ; Sun, 30 Jan 2005 05:33:52 -0600 (CST) (envelope-from jamoore@cromagnon.cullmail.com) Received: from localhost (localhost [[UNIX: localhost]]) by cromagnon.cullmail.com (8.12.10/8.12.10/Submit) id j0UBXpm9008098 for freebsd-questions@freebsd.org; Sun, 30 Jan 2005 05:33:51 -0600 (CST) (envelope-from jamoore) From: Jay Moore To: FreeBSD Mailing List Date: Sun, 30 Jan 2005 05:33:51 -0600 User-Agent: KMail/1.6.1 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200501300533.51350.jaymo@cromagnon.cullmail.com> Subject: running interactive program from shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jaymo@cromagnon.cullmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2005 11:35:29 -0000 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