Guest User

Untitled

a guest
Apr 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/bin/bash
  2. #*******************************************************#
  3. # Log things into a file in one consistent format #
  4. # I needed to change IFS else newlines were getting hogged#
  5. # appends to files (use genericdiary.sh to prepend to files)
  6. # Arunachalesha #
  7. # $Id$ #
  8. #*******************************************************#
  9. #TMPFILE=/usr/tmp/junk.$$
  10. #trap 'rm -f $TMPFILE; exit 0' 1 2 15
  11.  
  12. if [ $# -eq 0 ]
  13. then
  14. echo "I got no filename"
  15. exit 1
  16. fi
  17. logfile=$1
  18. today=$(date +"Date: %Y-%m-%d %H:%M")
  19. OLDIFS=$IFS
  20. IFS="~"
  21. echo Try to stick to maruku or markdown format
  22. echo End with Ctrl-D, Ctrl-C to abort
  23. echo " "
  24. echo -n "Enter title: "
  25. read title
  26. echo "Enter text, C-d to end:"
  27. text=`rlwrap cat`
  28.  
  29. #cat >> $logfile
  30.  
  31. echo "" >> $logfile
  32. title="Subject: $title"
  33. echo "$title" >> $logfile
  34. echo $title | sed 's/./-/g' >> $logfile
  35. echo $today >> $logfile
  36. echo "" >> $logfile
  37. echo $text >> $logfile
  38. echo "" >> $logfile
  39. echo '* * * * * * * *' >> $logfile
  40. echo Done
  41. echo "++++++"
  42. IFS=$OLDIFS
  43. tail $logfile
  44. echo Output went to $logfile
  45. #echo Use log2html.sh to view log in browser.
Add Comment
Please, Sign In to add comment