[PR #1615] [MERGED] Add comment for zsh users in the terminal example #1662

Closed
opened 2026-05-07 01:03:08 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1615
Author: @benkenawell
Created: 2/18/2026
Status: Merged
Merged: 2/19/2026
Merged by: @binwiederhier

Base: mainHead: example/zsh-terminal


📝 Commits (1)

  • 046c0e8 Add comment for zsh users in the terminal example

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 docs/examples.md (+3 -1)

📄 Description

Bash and Zsh terminals' history works slightly different. In bash, the current command is in the history already. In zsh, the history command does not have the currently running command in it. But it does set the HISTCMD variable to the entry number for the current command. So we can load the current command with history "$HISTCMD" in zsh and apply the same sed filter to get the same result as the bash history | tail -n1 command.

I think it makes more sense to leave this as a comment in the current example than to create a new example, since it otherwise works the exact same. I've added this to my workflow locally on my Mac and it works great! It took me a while to figure out the history difference though, so I thought it worth contributing back for zsh users.

Thank you for such a great and flexible piece of software!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/1615 **Author:** [@benkenawell](https://github.com/benkenawell) **Created:** 2/18/2026 **Status:** ✅ Merged **Merged:** 2/19/2026 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `example/zsh-terminal` --- ### 📝 Commits (1) - [`046c0e8`](https://github.com/binwiederhier/ntfy/commit/046c0e8c793f1d00356254afa13732ce230af2ca) Add comment for zsh users in the terminal example ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/examples.md` (+3 -1) </details> ### 📄 Description Bash and Zsh terminals' history works slightly different. In bash, the current command is in the history already. In zsh, the history command does not have the currently running command in it. But it does set the HISTCMD variable to the entry number for the current command. So we can load the current command with `history "$HISTCMD"` in zsh and apply the same sed filter to get the same result as the bash `history | tail -n1` command. I think it makes more sense to leave this as a comment in the current example than to create a new example, since it otherwise works the exact same. I've added this to my workflow locally on my Mac and it works great! It took me a while to figure out the history difference though, so I thought it worth contributing back for zsh users. Thank you for such a great and flexible piece of software! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:03:08 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1662
No description provided.