Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to keep HISTFILE variable untouched
- X-seq: zsh-users 29153
- From: Budi <budikusasi@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: How to keep HISTFILE variable untouched
- Date: Thu, 17 Aug 2023 21:43:31 +0700
- Archived-at: <https://zsh.org/users/29153>
- In-reply-to: <CAN=4vMp6qyCJP-ayjwve2xWTuASkSXJy6nxc9jnTXV3V_LCVgA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAH0GyZBDnN_Zw29K8y2WTcv8Qafwc-ktqnQv3e_2yotCfAM6ew@mail.gmail.com> <CAN=4vMp6qyCJP-ayjwve2xWTuASkSXJy6nxc9jnTXV3V_LCVgA@mail.gmail.com>
Simply works well
On 8/17/23, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> On Thu, Aug 17, 2023 at 11:28 AM Budi <budikusasi@xxxxxxxxx> wrote:
>>
>> At the end of
>>
>> % history -p
>>
>> The HISTFILE variable is cleaned up
>>
>> So how to keep HISTFILE variable remain untouched on any case ?
>
> You can invoke `history -pa` from a function, or pass $HISTFILE as an
> argument. What you should do depends on what you are trying to
> achieve. From the docs:
>
> fc -p [ -a ] [ filename [ histsize [ savehistsize ] ] ]
>
> `fc -p' pushes the current history list onto a stack and
> switches to a new history list. If the -a option is also
> specified, this history list will be automatically popped
> when the current function scope is exited, which is a
> much better solution than creating a trap function to
> call `fc -P' manually. If no arguments are specified,
> the history list is left empty, $HISTFILE is unset, and
> $HISTSIZE & $SAVEHIST are set to their default values.
> If one argument is given, $HISTFILE is set to that
> filename, $HISTSIZE & $SAVEHIST are left unchanged, and
> the history file is read in (if it exists) to initialize
> the new list. If a second argument is specified,
> $HISTSIZE & $SAVEHIST are instead set to the single
> specified numeric value. Finally, if a third argument is
> specified, $SAVEHIST is set to a separate value from
> $HISTSIZE. You are free to change these environment
> values for the new history list however you desire in
> order to manipulate the new history list.
>
> Roman.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author