aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2017-05-24 10:29:44 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2017-05-24 10:29:44 +0200
commitb06554d7815cdba00752cfea8771bf3ddf7757e9 (patch)
treedba775e70f97368cd9c7fdcf5c90b9ca4a04cd11
parent5965af247db1388018671369ec149d69fed159aa (diff)
Initial commitHEADmaster
-rw-r--r--README.md7
-rwxr-xr-xpbnotify12
2 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1a1cf68
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+# pbnotify
+
+pbnotify is a shell script for sending basic [PushBullet](https://www.pushbullet.com/) notifications.
+
+Usage: `pbnotify <title> <body>`
+
+In order to use the API, an API key is required. This script looks for it in the `$PB_API` environment variable, so set your environment accordingly.
diff --git a/pbnotify b/pbnotify
new file mode 100755
index 0000000..44b0661
--- /dev/null
+++ b/pbnotify
@@ -0,0 +1,12 @@
+#!/usr/bin/bash
+
+if [ $# -lt 2 ]; then
+ echo "Arguments missing! Usage: pbnotify \"message title\" \"message body\""
+ exit 1
+fi
+
+curl -u $PB_API:\
+ -X POST https://api.pushbullet.com/v2/pushes \
+ --header 'Content-Type: application/json' \
+ --data-binary "{\"type\": \"note\", \"title\": \"$1\", \"body\": \"$2\"}" \
+ --silent > /dev/null