Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [beta8] history saved on exec doesn't.



On May 24,  2:51pm, P.Stephenson@xxxxxxxxxxxxx wrote:
} Subject: Re: [beta8] history saved on exec doesn't.
}
} > One other thing that is now broke is if I do any command substitution in
} > the startup scripts (to set a variable say) after I have set the SAVEHIST
} > and HISTFILE variables, and I don't have APPEND_HISTORY set, then this wipes
} > out the history file as well.
}
} Actually, this is a good point and I don't think any of the clever
} exec stuff should ever be done in a subshell (if forked is set in
} execcmd()).  This includes the SHLVL decrement since if you're
} exec'ing a command in subshell you should presumably still `see' the
} level of the parent shell

I confess to have been pretty much ignoring zsh-list at the time this
"clever exec stuff" was being put in, so please pardon any ignorance
in the following questions, but:

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.

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.)

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.)

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"?)

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@xxxxxxxxxx               Division of Network Computing Devices, Inc.
http://www.well.com/www/barts



Messages sorted by: Reverse Date, Date, Thread, Author