Merge pull request #1615 from benkenawell/example/zsh-terminal
Add comment for zsh users in the terminal example
This commit is contained in:
@@ -661,6 +661,8 @@ Add the following function and alias to your `.bashrc` or `.bash_profile`:
|
|||||||
local token=$(< ~/.ntfy_token) # Securely read the token
|
local token=$(< ~/.ntfy_token) # Securely read the token
|
||||||
local status_icon="$([ $exit_status -eq 0 ] && echo magic_wand || echo warning)"
|
local status_icon="$([ $exit_status -eq 0 ] && echo magic_wand || echo warning)"
|
||||||
local last_command=$(history | tail -n1 | sed -e 's/^[[:space:]]*[0-9]\{1,\}[[:space:]]*//' -e 's/[;&|][[:space:]]*alert$//')
|
local last_command=$(history | tail -n1 | sed -e 's/^[[:space:]]*[0-9]\{1,\}[[:space:]]*//' -e 's/[;&|][[:space:]]*alert$//')
|
||||||
|
# for zsh users, use the same sed pattern but get the history differently.
|
||||||
|
# local last_command=$(history "$HISTCMD" | sed -e 's/^[[:space:]]*[0-9]\{1,\}[[:space:]]*//' -e 's/[;&|][[:space:]]*alert$//')
|
||||||
|
|
||||||
curl -s -X POST "https://n.example.dev/alerts" \
|
curl -s -X POST "https://n.example.dev/alerts" \
|
||||||
-H "Authorization: Bearer $token" \
|
-H "Authorization: Bearer $token" \
|
||||||
@@ -692,4 +694,4 @@ To test failure notifications:
|
|||||||
false; alert # Always fails (exit 1)
|
false; alert # Always fails (exit 1)
|
||||||
ls --invalid; alert # Invalid option
|
ls --invalid; alert # Invalid option
|
||||||
cat nonexistent_file; alert # File not found
|
cat nonexistent_file; alert # File not found
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user