2ck

ILog

2ck
Feb 27th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/sh
  2. # For making little notes for posterity
  3. # Copyright (c) 2012 2ck
  4. cd ~/ideas
  5.  
  6. timestamp=`date --rfc-3339=seconds`
  7. nideas=`ls -1 | wc -l`
  8.  
  9. if [ -z "$1" ] ; then
  10.     echo "I need a title, kid."
  11.     exit 1
  12. fi
  13.  
  14. fname=`echo $nideas-$1 | sed -e "s/ /_/"`
  15.  
  16. echo "$1" | tr '[a-z]' '[A-Z]' | cat >dt
  17. echo "$1 " | sed s/./-/g | cat >>dt
  18. echo >>dt
  19. echo >>dt
  20. echo --$USER >>dt
  21. echo $timestamp >>dt
  22.  
  23. vim -c "read dt" -c "set wrap" -c 'startinsert' +/^$/ "$fname"
  24. rm dt
  25.  
  26. if [ -e .$fname.sw* ] ; then
  27.     rm -v .$fname.sw*
  28. fi
Advertisement
Add Comment
Please, Sign In to add comment