From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7407 invoked from network); 22 Sep 1999 09:08:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Sep 1999 09:08:27 -0000 Received: (qmail 14475 invoked by alias); 22 Sep 1999 09:07:49 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2611 Received: (qmail 14468 invoked from network); 22 Sep 1999 09:07:42 -0000 From: "Bart Schaefer" Message-Id: <990922085717.ZM16212@candle.brasslantern.com> Date: Wed, 22 Sep 1999 08:57:17 +0000 In-Reply-To: <19990922001426.B16998@ichips.intel.com> Comments: In reply to Clint Olsen "Re: "exec zsh" inside .zprofile doesn't set SHELL" (Sep 22, 12:14am) References: <19990921150657.A14612@ichips.intel.com> <990921223441.ZM15797@candle.brasslantern.com> <19990921163747.A19650@ichips.intel.com> <990922002045.ZM15869@candle.brasslantern.com> <19990921173438.B37706@ichips.intel.com> <990922051813.ZM15980@candle.brasslantern.com> <19990922001426.B16998@ichips.intel.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Clint Olsen Subject: Re: "exec zsh" inside .zprofile doesn't set SHELL Cc: zsh-users@sunsite.auc.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 22, 12:14am, Clint Olsen wrote: } Subject: Re: "exec zsh" inside .zprofile doesn't set SHELL } } I'm executing this in my .zprofile (nothing fancy). So far, I've not had } any problems with looping execs. Apparently the results of "exec $SHELL" } doesn't make it a login shell again. Am I overlooking something? That's right, "exec zsh" will not propagate login-shell-ness. The best you can do is "exec zsh -$-" which passes to the new zsh all the setopts of the current one that can be represented as command-line flags. That _will_ propagate login-ness, so then you need something like [[ "$ZSH_VERSION" = 3.0.5 ]] && export SHELL==zsh && exec $SHELL -$- The problem with testing version numbers is that, whichever way you do the equality (equal the old version or not-equal the new one), the wrong thing may happen if one or the other gets upgraded. And if for some reason the output of =zsh is the path to the old version, you still have a loop. So IMO a better solution is export SHELL==zsh && export ZDOTDIR=$HOME/.myzsh && exec $SHELL -$- The files in .myzsh can be links to the ones in $HOME (or in your regular $ZDOTDIR if there is one) *except* for the one that contains the "exec", so you can't possibly hit that more than once. On a consulting job I did a while back the system zsh was version 2.4 (!!) so I quickly compiled a 3.0.5 and set it up like this: ~/.zprofile contained: [[ -f ~/.myzsh/.zprofile ]] && source ~/.myzsh/.zprofile if ~/bin/zsh -fc 'exit 0'; then export SHELL=$HOME/bin/zsh export ZDOTDIR=$HOME/.myzsh exec $SHELL -$- fi ~/.myzsh/.zprofile didn't exist, that "source" was for completeness. ~/.zshenv and ~/.zlogin had a lot of skeleton setup stuff for my client's local build environment, so left them alone. ~/.myzsh/.zshenv contained a "source ~/.zshenv" followed by some extra setup stuff for 3.0.5. ~/.myzsh/.zlogin was the .zlogin that I cart around with me everywhere, that handles every version of zsh from 2.0 through (then) 3.1.5 and makes them act as much alike as possible, with "source ~/.zlogin" stuck in at a strategic point. ~/.myzsh/.zlogout was a symlink to ~/.zlogout. ~/.zshrc was the version 2.4 initialization stuff. ~/.myzsh/.zshrc was my 3.0.5 initialization stuff. Running zsh -fc in the "if" test was in case I logged in to a machine that wasn't the same architecture as the one on which I built ~/bin/zsh; they had a small number that were different, but I don't think I ever actually used one. Anyway, the end result was that I'd launch 3.0.5 but duplicate reading only of the zshenv files, while falling through if my homebuilt zsh didn't work for some reason. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com