From owner-freebsd-questions@FreeBSD.ORG Thu Nov 25 23:30:33 2004 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 AFD0816A4CE for ; Thu, 25 Nov 2004 23:30:33 +0000 (GMT) Received: from lakermmtao05.cox.net (lakermmtao05.cox.net [68.230.240.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 291E343D3F for ; Thu, 25 Nov 2004 23:30:33 +0000 (GMT) (envelope-from conrads@cox.net) Received: from dolphin.local.net ([68.11.30.24]) by lakermmtao05.cox.net (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP id <20041125233031.LXL8725.lakermmtao05.cox.net@dolphin.local.net>; Thu, 25 Nov 2004 18:30:31 -0500 Received: from dolphin.local.net (localhost.local.net [127.0.0.1]) by dolphin.local.net (8.13.1/8.13.1) with SMTP id iAPNUN6D074337; Thu, 25 Nov 2004 17:30:23 -0600 (CST) (envelope-from conrads@cox.net) Date: Thu, 25 Nov 2004 17:30:18 -0600 From: "Conrad J. Sabatier" To: conrads@cox.net Message-ID: <20041125173018.0444d52c@dolphin.local.net> In-Reply-To: <1101405587.63632.10.camel@dolphin.local.net> References: <41A615CE.6010405@Silver-Lynx.com> <1101405587.63632.10.camel@dolphin.local.net> X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; amd64-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org cc: Don Wilde Subject: Re: shell programming challenge X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2004 23:30:33 -0000 On Thu, 25 Nov 2004 11:59:47 -0600, "Conrad J. Sabatier" wrote: > On Thu, 2004-11-25 at 10:26 -0700, Don Wilde wrote: > > Hey, folks - > > > > I need to find a way to kick off an xterm running BASH and then > > execute a program within that xterm, but NOT close the new xterm > > after the program finishes. Another desirable thing would be to also > > be able to 'source in' a file of shell environment that would affect > > the new window > > and shell. > > > > Here's what I've found out so far: > > > > Assume we have an executable test file 'ticktock': > > > > #!/bin/sh > > for n in 1 2 3 4 5 6 7 8 > > do > > echo "$n MYVAR=$MYVAR" > > sleep 1 > > echo -n "continue? " > > read reply > > done > > # end of ticktock > > > > I want to do something like: > > > > xterm -e bash <(echo ./ticktock) & > > > > When I do this, the program works & interacts, but the xterm dies > > upon completion of ticktock or INT. I also do not seem to be able to > > use the --rcfile switch as a bash option, although I can add > > KEY=VALUE pairs before the xterm launch. > > > > Ideas? Please respond to me directly. > > man xterm. There *is* an option to keep the term open after executing > a program. OK, I think I've found what you're looking for: xterm -e "/usr/local/bin/bash --rcfile bash_commands -i" Substitute your program's startup script for "bash_commands" in the above. Using the "-i" switch to bash forces interactive mode, so when the script exits, you'll be returned to the shell prompt in the xterm. As it turns out, xterm's "-hold" switch is wholly unnecessary here. Note that the "--rcfile" switch, being a "double-hyphened" option, must precede the later "-i" switch in order to be recognized. HTH -- Conrad J. Sabatier -- "In Unix veritas"