Skip to content

Instantly share code, notes, and snippets.

@zemlanin
Created August 14, 2014 16:14
Show Gist options
  • Save zemlanin/ed7e99f1c7f1d70aff16 to your computer and use it in GitHub Desktop.
Save zemlanin/ed7e99f1c7f1d70aff16 to your computer and use it in GitHub Desktop.
push.sh
# send message to your devices via pushover.net API
# add next two or three lines to .bashrc/.zshrc to use this script
# export PUSHOVER_APP="your pushover.net app token"
# export PUSHOVER_USER="your pushover.net user key"
# # optional:
# export PUSHOVER_DEVICE="default device"
# USAGE: push <message> [-d=<device>]
# OPTIONS:
# -d Device name (send to $PUSHOVER_DEVICE if empty)
__pushover(){
local device=""
local message=$1
shift 1
while getopts ":d:" OPTION
do
case $OPTION in
d)
device=$OPTARG
;;
esac
done
if [[ -z $device ]]
then
device=$PUSHOVER_DEVICE
fi
if [[ -z $message ]]
then
echo 'message required'
else
command curl -s -F "token=$PUSHOVER_APP" \
-F "user=$PUSHOVER_USER" \
-F "message=$message" \
-F "device=$device" \
https://api.pushover.net/1/messages.json
fi
}
alias push=__pushover
@zemlanin
Copy link
Author

yop.sh for Yo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment