zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: An example of writing a custom history file?
Date: Mon, 15 Dec 2014 17:46:32 +0000	[thread overview]
Message-ID: <20141215174632.29e30bbe@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CANCp2gbheXK_et_xr55Tg3jyb9HmS8wtUOzz5cZpZu3SgcNOfA@mail.gmail.com>

On Mon, 15 Dec 2014 12:05:30 -0500
Rocky Bernstein <rockyb@rubyforge.org> wrote:
> Making the change suggested, adding 1000 doesn't change the behavior - no
> file is written. Again, here is the entire 12-line program:
> 
>     #!/usr/bin/zsh
>     fc -ap /tmp/example_history 1000
> 
>     local line
>     # Read lines and add them to history
>     while vared -h -p "hey: " line
>     do
>         [[ $line == 'quit' ]] && exit 0
>         # The -s option below adds the line to the history
>         print -s $line
>         line=''
>     done

I'm not entirely following everything you're attempting to do, but the
feature you're using is for temporarily switching a history file during
a shell session.  So if you're running this as a script (rather than a
shell function), as the #! and the word "program" would imply, (i)
you're not really trying out that aspect of the feature --- though
there's no reason the basic feature shouldn't work (ii) you don't get
the "autopop" behaviour at the end of function scope that the -a
additional option to fc -p implies.

Try using "fc -P" at the end to pop by hand, as if this actually were a
function (but with the save line number argument suggested by Bart).

pws


  reply	other threads:[~2014-12-15 17:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15  1:38 Rocky Bernstein
2014-12-15  2:53 ` Bart Schaefer
2014-12-15  7:09   ` Rocky Bernstein
2014-12-15  8:37     ` Bart Schaefer
2014-12-15 14:26       ` Rocky Bernstein
2014-12-15 16:14         ` Bart Schaefer
2014-12-15 17:05           ` Rocky Bernstein
2014-12-15 17:46             ` Peter Stephenson [this message]
2014-12-15 18:22             ` Mikael Magnusson
2014-12-16  3:58               ` Rocky Bernstein
2014-12-15 18:26             ` Bart Schaefer
2014-12-15 18:34               ` Mikael Magnusson
2014-12-16 11:36                 ` Peter Stephenson
2014-12-16  5:57               ` Rocky Bernstein

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=20141215174632.29e30bbe@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).