Skip to content

Instantly share code, notes, and snippets.

@EllieTheYeen
Created November 2, 2024 05:13
Show Gist options
  • Save EllieTheYeen/f517cd9ad4ec427abe6fa34dd8965e5a to your computer and use it in GitHub Desktop.
Save EllieTheYeen/f517cd9ad4ec427abe6fa34dd8965e5a to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ${#@} -gt 1 ]; then
TITLE="$1"
BODY="${@:2}"
else
TITLE=""
BODY="$@"
fi
token="$(cat ~/.pushtoken)"
curl \
-X POST \
--header "Access-Token: $token" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'type=note' \
--data-urlencode "title=$TITLE" \
--data-urlencode "body=$BODY" \
'https://api.pushbullet.com/v2/pushes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment