#!/bin/sh case "$#" in 0) echo 'no destination'; exit 1 ;; *) dest=$1 ;; esac incfile=$HOME/.tstmsg test -f $incfile || echo 0 > $incfile test -f $incfile || exit 1 k=`cat $incfile` k=`expr $k + 1` echo $k > $incfile now=`date "+%Y-%m-%d %T"` sub="Test msg $k at $now" echo "Test msg $k" | mail -s "$sub" $dest exit 0