Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #*******************************************************#
- # Log things into a file in one consistent format #
- # I needed to change IFS else newlines were getting hogged#
- # appends to files (use genericdiary.sh to prepend to files)
- # Arunachalesha #
- # $Id$ #
- #*******************************************************#
- #TMPFILE=/usr/tmp/junk.$$
- #trap 'rm -f $TMPFILE; exit 0' 1 2 15
- if [ $# -eq 0 ]
- then
- echo "I got no filename"
- exit 1
- fi
- logfile=$1
- today=$(date +"Date: %Y-%m-%d %H:%M")
- OLDIFS=$IFS
- IFS="~"
- echo Try to stick to maruku or markdown format
- echo End with Ctrl-D, Ctrl-C to abort
- echo " "
- echo -n "Enter title: "
- read title
- echo "Enter text, C-d to end:"
- text=`rlwrap cat`
- #cat >> $logfile
- echo "" >> $logfile
- title="Subject: $title"
- echo "$title" >> $logfile
- echo $title | sed 's/./-/g' >> $logfile
- echo $today >> $logfile
- echo "" >> $logfile
- echo $text >> $logfile
- echo "" >> $logfile
- echo '* * * * * * * *' >> $logfile
- echo Done
- echo "++++++"
- IFS=$OLDIFS
- tail $logfile
- echo Output went to $logfile
- #echo Use log2html.sh to view log in browser.
Add Comment
Please, Sign In to add comment