From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.10/8.6.9) with SMTP id BAA11697 for ; Fri, 26 May 1995 01:50:20 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA10799 (5.65c/Gatech-10.0-IDA for ); Thu, 25 May 1995 11:50:25 -0400 Received: by math (5.x/SMI-SVR4) id AA25252; Thu, 25 May 1995 11:48:24 -0400 Old-Return-Path: Resent-From: schaefer@z-code.com (Barton E. Schaefer) Resent-Message-Id: <950525083306.ZM12438@zyrcon.z-code.com> Resent-Date: Thu, 25 May 1995 08:33:06 -0700 X-Mailer: Z-Mail Lite (3.3dev.524 24may95) Resent-To: zsh-workers@math.gatech.edu Resent-From: "Barton E. Schaefer" Resent-Message-Id: <9505241430.ZM557@zyrcon.z-code.com> Resent-Date: Wed, 24 May 1995 14:30:57 -0700 X-Mailer: Z-Mail (3.2.1 10apr95) Resent-To: zsh-workers-request@math.gatech.edu From: P.Stephenson@swansea.ac.uk Message-Id: <31976.9505241655@pyro.swan.ac.uk> To: schaefer@z-code.z-code.com Subject: Re: [beta8] history saved on exec doesn't. In-Reply-To: "schaefer@z-code.com"'s message of "Wed, 24 May 95 08:42:39 PDT." <9505240842.ZM19150@zyrcon.z-code.com> Date: Wed, 24 May 95 17:55:35 +0100 X-Mts: smtp X-Mailing-List: archive/latest/34 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu schaefer@z-code.com wrote: > I presume "clever exec stuff" really does mean "clever stuff done at > time of an `exec' zsh builtin" and *not* "clever stuff done whenever > any call in the exec(2) family is about to be made". That is, I can't > believe zsh is now saving history every time any non-builtin command > is run. Please tell me I'm right. yep > Then tell me, if I am right, why process substitution would have caused > history to be saved in the first place. (I completely agree about never > doing anything like this in subshells in general.) This is the new code that allows something like $(cmd) to exec the last command directly from the shell instead of forking as a shortcut. Certainly nothing funny should have happened here; that was a bug which the new patch fixes. > Next, explain "the SHLVL decrement" a bit; I have scripts that depend on > knowing whether they were exec'd from a login shell or from a shell > started via my .xsession, and they presently do it by examining SHLVL. > If SHLVL is suddenly going to start reverting to 1 when a level-2 shell > does an exec, my standard login routine is going to end up in an infinite > loop. (As you can tell, I haven't installed any of these betas yet.) This was added at popular request to avoid `exec zsh' bumping up SHLVL, since you can't tell how the new shell started off. It's still now `correct' in the sense that it counts how many higher level zsh's are present (arguably it's more consistent than before when it counted just the number of zsh's which had ever started up in its past, which is not something you usually want to know), but that will be off by one from the previous one, so it looks like you've found another incompatibility. In other words, you'd have to check whether SHLVL was 0 or 1 instead of 1 or 2. (It does go down to zero like it should, though; I checked.) > Finally, please tell me there's some way to shut off all this stuff and > have an exec just be an exec. At least some way to shut off saving of > history on exec; I don't know who thinks this is useful, but the last > N things I typically do before any interactive shell would "exec" are > either stuff from my .zlogin or commands I wouldn't want to repeat unless > I were about to do *another* exec, and as such I'd rather the history > were just left alone. Perhaps one of: > > alias exec='SAVEHIST=0 exec' > alias exec='HISTFILE=/dev/null exec' > > (Or do we still have to use "exec HISTFILE=/dev/null"?) No, this syntax for exec now works (which I didn't realise so I've only just altered the FAQ), but unfortunately it sets the variable too late. Errr... and you can't actually alias exec (somebody else fix this, I'm tired of endlessly fixing bugs). The code you need is SAVEHIST=0; exec or perhaps you'd better make that ((SHLVL++, SAVEHIST=0)); exec (In fact, it looks like the main advantage of your upgrading to a more recent version of zsh would be that you get to complain about the new features quicker :-/). -- Peter Stephenson Tel: +44 1792 205678 extn. 4461 WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324 Department of Physics, University of Wales, Swansea, Singleton Park, Swansea, SA2 8PP, U.K.