#! /bin/sh # ############################################################################# NAME_="xmesg" HTML_="display X window message" PURPOSE_="display an X window message on a regular basis" SYNOPSIS_="$NAME_ [-hl] s|m|h|d ''" REQUIRES_="standard GNU commands" VERSION_="1.0" DATE_="2004-03-14; last update: 2004-03-14" AUTHOR_="Dawid Michalczyk " URL_="www.comp.eonworks.com" CATEGORY_="desk" PLATFORM_="Linux" SHELL_="bash" DISTRIBUTE_="yes" # ############################################################################# # This program is distributed under the terms of the GNU General Public License usage () { echo >&2 "$NAME_ $VERSION_ - $PURPOSE_ Usage: $SYNOPSIS_ Requires: $REQUIRES_ Options: s|m|h|d, an integer referring to seconds|minutes|hours|days; the time interval for how often to display the message '', a single quoted message to display -h, usage and options (this help) -l, see this script" exit 1 } # enabling extended globbing shopt -s extglob # option handling case $1 in -h) usage ;; -l) more $0; exit 1 ;; +([0-9])[smhd] ) [[ $2 ]] || { echo >&2 missing second argument, type $NAME_ -h for help; exit 1; } while :;do sleep ${1} # display windowed message if x is running ps -aux | grep -q xinit [ $? = 0 ] && xmessage -center $2 done ;; *) echo invalid or missing argument, type $NAME_ -h for help; exit 1 ;; esac