#!/bin/sh # sends xnotify a notification unset TAG SEC exec > ${XNOTIFY_FIFO:=$HOME_CACHE/xnotify$DISPLAY.fifo} ug_err() { echo "${1}" 1>&2 && return "${2:-1}" } usage() { ug_err "usage: ${0##*/} [ -s seconds ] [ -t tag ] [BODY] -s seconds seconds for notification to live -t tag category of notification" exit } while getopts s:t: arg; do case ${arg} in s) SEC=${OPTARG};; t) TAG=${OPTARG};; *) usage;; esac done if [ -n "$SEC" ]; then printf 'SEC:%s\t' "$SEC" shift 2 fi if [ -n "$TAG" ]; then printf 'TAG:%s\t' "$TAG" shift 2 fi case "$#" in 1) printf '%s\n' "$1";; 2) printf '%s\t%s\n' "$1" "$2";; *) exit;; esac