Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

$history[@] doesn't contain last element from $HISTFILE



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



Messages sorted by: Reverse Date, Date, Thread, Author