#!/bin/sh - subinfo="$1" privkey="$2" claim="$3" if ! [ -f "$1" ] || [ $# != 1 -a $# != 3 ]; then echo "Usage: $0 [ ]" exit 1 fi tmpfname="tmp.pushinfo.$$" cat - > "$tmpfname" title=$(grep -i "^Subject:" "$tmpfname" | sed -e 's/.*:[ ]*//') jq --rawfile msg "$tmpfname" --arg title "$title" -n '{ "title": $title, "body": $msg, "icon" : "static/i-ico.png", "image" : "static/i-banner.png" }' | pywebpush -v --data /dev/stdin --info "$subinfo" \ --key "${privkey}" --claims "${claim}" rm "$tmpfname"