I am attempting to write a script for GeekTool that will show my last X (20) commands on my screen.
I can either display a file or use the output of a shell command (preferred).
The problem is that when I run the command from a script I get ~/bin/update_history_file.sh:fc:5: no such event: 0
as an error.
My script file is:
#!/bin/zsh --login
#history | tail -n 25 > /tmp/history.txt
export HISTFILE=~/.zsh_history
fc -l -20 -1
The fc
command works if I run it from a shell; however if I run it from the script then it fails. I think it has something to do with it not being able to read the history file, but have no confirmation of this.
I can not directly use the .zsh_history
file as I use ZSH extended history and has embedded meta data.