#!/bin/sh # TimeStampOutput.sh # Fri Jun 19 17:47:56 PDT 2009 # Chieh Cheng # http://www.CynosureX.com/ # GNU General Public License (GPL) Version 2, June 1991 scriptName=`basename "$0"` usage () { echo " Usage: ${scriptName} [ \"prefix\" ] [ \"suffix\" ]" } if [ $# -eq 0 ] || [ $# -eq 2 ] then prefix="" suffix="" if [ $# -eq 2 ] then prefix="$1" suffix="$2" fi previous="" while read line do timeStamp=`date` if [ "${timeStamp}" != "${previous}" ] then echo "${prefix}${timeStamp}${suffix}" fi echo "${line}" previous="${timeStamp}" done else usage fi