Bourne Shell Logging Routine

Here’s another logging routine, this one is written in Bourne shell:

#!/bin/sh

log_message() {
    echo `date "+%m/%d/%y %H:%M:%S %Z"` "$1" | tee -a aaa.out
}

log_message "Hello there"
log_message "Goodbye"

Sample output:

08/28/07 23:16:13 EDT Hello there
08/28/07 23:16:13 EDT Goodbye

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.