#!/bin/sh . "lib_common.sh" . "lib_handle.sh" help() { cat << EOF ${argv0}: Send notifications options: -s [Msg] Send Msg -t [Time] Disappear after Time (in second) -h Print this message and exit Note: time must be between 0 and 300, by default time is set to unlimited. EOF exit 0 } [ "${#}" -eq 0 ] && invalid_use time=-1 while getopts "s:t:h" option; do case "${option}" in s) msg="${OPTARG}" ;; t) time="${OPTARG}" case "${time}" in ''|*[!0-9]*) err "Not a number: ${time}" ;; esac [ "${time}" -gt 300 ] && err "Out of range: ${time}" ;; h) help ;; *) invalid_use -h ;; esac done shift $((OPTIND - 1)) [ ${#} != 0 ] && invalid_use notify_handle send "${time}" "${msg}"