zsh-users
 help / color / mirror / code / Atom feed
* How to keep HISTFILE variable untouched
@ 2023-08-17  9:27 Budi
  2023-08-17  9:38 ` Roman Perepelitsa
  0 siblings, 1 reply; 3+ messages in thread
From: Budi @ 2023-08-17  9:27 UTC (permalink / raw)
  To: Zsh Users

At the end of

 % history -p

The HISTFILE variable is cleaned up

So how to keep HISTFILE variable remain untouched on any case ?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to keep HISTFILE variable untouched
  2023-08-17  9:27 How to keep HISTFILE variable untouched Budi
@ 2023-08-17  9:38 ` Roman Perepelitsa
  2023-08-17 14:43   ` Budi
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Perepelitsa @ 2023-08-17  9:38 UTC (permalink / raw)
  To: Budi; +Cc: Zsh Users

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to keep HISTFILE variable untouched
  2023-08-17  9:38 ` Roman Perepelitsa
@ 2023-08-17 14:43   ` Budi
  0 siblings, 0 replies; 3+ messages in thread
From: Budi @ 2023-08-17 14:43 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Zsh Users

Simply works well

On 8/17/23, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
> 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.
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-17 14:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17  9:27 How to keep HISTFILE variable untouched Budi
2023-08-17  9:38 ` Roman Perepelitsa
2023-08-17 14:43   ` Budi

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