hstr
hstr copied to clipboard
Hstr looks for .zshistory even though HISTFILE is set to something else.
Hi there,
I'm currently trying to switch from bash to zsh. hstr worked perfectly with bash, but I am encountering the following problem with zsh:
just executing hstr (or pressing ctrl+r) give me the error:
marian@marian-ThinkPad-P51:~$ hstr
Unable to read history file from '/home/marian/.zhistory'!
However, HISTFILE
is set to .bash_eternal_history
, as it is configured in my .zshrc:
marian@marian-ThinkPad-P51:~$ echo $HISTFILE
/home/marian/.bash_eternal_history
Is this a bug or are misconfiguration on my side? I would assume that hstr also looks at the HISTFILE variable.
Getting the same issue on my setup. For now using symlink as workaround.
@Aetherbase @kannwism increasing priority - thank you :pray: I will it in the upcoming release.
is there any progress or workaround on this issue?
@guyeu @kannwism I tried to repro this issue multiple times, however, it works for me. Please check below what I tried:
- I created file
.bash_eternal_history
in my home directory i.e./home/dvorka/.bash_eternal_history
(and stored only 1 entry to that file: "BUG REPRO"). - I added
export HISTFILE=/home/dvorka/.bash_eternal_history
to.zshrc
. - I created brand new shell.
- I checked that the variable is set using
echo $HISTFILE
. - I ran
hstr
and it loaded the file specified by$HISTFILE
variable w/ the entry.
I will need more details to repro. What's interesting is that you are loading "bash" history in Zsh. Also HSTR uses .zhistory
as the last fallback when:
- Shell is Zsh.
-
HISTFILE
variable is NOT defined. -
/home/$USER/.zsh_history
does not exist.
Perhaps the file exist, but its content cannot be loaded. Could you please try:
- Backup your
.bash_eternal_history
. - Store to
.bash_eternal_history
only 1 row w/ a simple string likeTEST
. - Create new shell.
- Run HSTR?
Can you please also share:
- your Linux distribution and version
-
hstr --version
-
zsh --version
Thanks!
Hi @dvorka,
thanks for looking into it! I faced the issue on a company Ubuntu laptop, which, unfortunately, I don't have anymore. On my current machine (mac) everything is working fine. Maybe @guyeu has the ability to reproduce the issue at the moment?
I have this issue before.
I set HISTFILE
with
HISTFILE="$HOME/.cache/zsh_history"
I found that I missing export
. Solve it after adding export
export HISTFILE="$HOME/.cache/zsh_history"