Last active
October 21, 2023 15:18
-
-
Save tunalad/8316da055eb16586fd809b56f86bf32f to your computer and use it in GitHub Desktop.
A wrapper script for curl to send push notifications via ntfy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
seed="your seed here" | |
random_string=$(echo "$seed" | sha256sum | cut -c 1-32) | |
url="ntfy.sh/$random_string" | |
message="example" | |
headers=() | |
data="-d \"$message\"" | |
while [[ $# -gt 0 ]]; do | |
case "$1" in | |
-H|--header) | |
headers+=("-H \"$2\"") | |
shift 2 | |
;; | |
-d|--data) | |
data="-d \"$2\"" | |
shift 2 | |
;; | |
*) | |
shift | |
;; | |
esac | |
done | |
eval "curl ${headers[*]} $data \"$url\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment