zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Budi <budikusasi@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: How to keep HISTFILE variable untouched
Date: Thu, 17 Aug 2023 11:38:53 +0200	[thread overview]
Message-ID: <CAN=4vMp6qyCJP-ayjwve2xWTuASkSXJy6nxc9jnTXV3V_LCVgA@mail.gmail.com> (raw)
In-Reply-To: <CAH0GyZBDnN_Zw29K8y2WTcv8Qafwc-ktqnQv3e_2yotCfAM6ew@mail.gmail.com>

On Thu, Aug 17, 2023 at 11:28 AM Budi <budikusasi@gmail.com> 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.


  reply	other threads:[~2023-08-17  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  9:27 Budi
2023-08-17  9:38 ` Roman Perepelitsa [this message]
2023-08-17 14:43   ` Budi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMp6qyCJP-ayjwve2xWTuASkSXJy6nxc9jnTXV3V_LCVgA@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=budikusasi@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).