zsh-workers
 help / color / mirror / code / Atom feed
* $history[@] doesn't contain last element from $HISTFILE
@ 2016-10-14 16:32 Sebastian Gniazdowski
  2016-10-14 17:44 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-10-14 16:32 UTC (permalink / raw)
  To: Zsh hackers list

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


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

end of thread, other threads:[~2016-10-14 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14 16:32 $history[@] doesn't contain last element from $HISTFILE Sebastian Gniazdowski
2016-10-14 17:44 ` Bart Schaefer
2016-10-14 18:35   ` Sebastian Gniazdowski
2016-10-14 19:10     ` Bart Schaefer

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