From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3436 invoked from network); 7 Sep 2001 22:03:46 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Sep 2001 22:03:46 -0000 Received: (qmail 13562 invoked by alias); 7 Sep 2001 22:03:36 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15749 Received: (qmail 13550 invoked from network); 7 Sep 2001 22:03:35 -0000 Date: Fri, 7 Sep 2001 23:45:17 +0100 From: Adam Spiers To: zsh-workers@sunsite.dk Subject: Re: Switching shell safely and efficiently Message-ID: <20010907234517.A6901@thelonious.new.ox.ac.uk> Reply-To: Adam Spiers Mail-Followup-To: zsh-workers@sunsite.dk References: <20010907193550.A5678@thelonious.new.ox.ac.uk> <1010907190526.ZM17902@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <1010907190526.ZM17902@candle.brasslantern.com>; from schaefer@brasslantern.com on Fri, Sep 07, 2001 at 07:05:26PM +0000 X-Home-Page: http://www.new.ox.ac.uk/~adam/ X-OS: RedHat Linux Bart Schaefer (schaefer@brasslantern.com) wrote: > run_shell=`$myshell -c "echo exec $myshell" || echo :` > eval $run_shell '"$@"' Cute trick! Nice enough to put in the FAQ, I think. Although much more stylish than my attempt, it's not quite as efficient through having to fork the shell before running it properly. To this end, a slight improvement might be skipping start-up files: run_shell=`$myshell -f -c "echo exec $myshell" || echo :` eval $run_shell '"$@"' I haven't done any benchmarking of the different approaches though.