#!/bin/sh # # Write a possibly-colourised string to the alert log. # - Cameron Simpson # cmd=$0 usage="Usage: $cmd [-c colour] [echo-args...]" : ${LOGDIR:=$HOME/var/log} : ${ALERTLOG:=$LOGDIR/alert} exec >>"$ALERTLOG" badopts= colour= case $1 in -c) colour=$2; shift; shift ;; --) shift ;; -?*)echo "$cmd: unrecognised option: $1" >&2; badopts=1; shift ;; esac [ $badopts ] && { echo "$usage" >&2; exit 2; } [ $# = 0 ] && set -- "`cat`" if [ -n "$colour" ] then colour_echo "$colour" "$*" else echo "$*" fi case $ARCH in apple.*.darwin) growlnotify -m "$*" ;; esac