From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: $history[@] doesn't contain last element from $HISTFILE
Date: Fri, 14 Oct 2016 18:32:04 +0200 [thread overview]
Message-ID: <CAKc7PVDE94RMgquJtPU5hgBoC0TUSNHzfocZV7DXgajtJME2jg@mail.gmail.com> (raw)
typeset -a list
() {
echo "a" >! phist2.db
echo "b" >>! phist2.db
fc -Rap "phist2.db"
list=( ${history[@]} )
echo "${history[2]}"
echo "${history[1]}"
echo "${#history}";
integer size="${#history}"
size+=1
echo "$size" / "${history[$size]}"
}
print -rl "Now:" "${list[@]}"
b
a
1
2 / b
Now:
a
The output should be:
b
a
My workaround is:
list=( "${history[$size]}" ${history[@]} )
Best regards,
Sebastian Gniazdowski
next reply other threads:[~2016-10-14 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 16:32 Sebastian Gniazdowski [this message]
2016-10-14 17:44 ` Bart Schaefer
2016-10-14 18:35 ` Sebastian Gniazdowski
2016-10-14 19:10 ` Bart Schaefer
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=CAKc7PVDE94RMgquJtPU5hgBoC0TUSNHzfocZV7DXgajtJME2jg@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=zsh-workers@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).