Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!bin/bash
  2.  
  3. # This script is for me creating my brain dumps that I usually do jumping right into it in vim.
  4. # I have a template file also defined that I can setup if I want.
  5. # This script also brings me back to the same context that I was in earlier
  6.  
  7. set -ex
  8.  
  9. cd ~/brain-dumps/
  10.  
  11. # Ex. 2019-04-14
  12. DATE=`date +%Y-%m-%d`
  13. EXTENTION='.md'
  14. FILE_NAME="$DATE$EXTENTION"
  15.  
  16. if test -f "$FILE_NAME"
  17. then
  18. echo "File exists. Opening existing for $DATE"
  19. else
  20. # Simple template
  21. echo "# Brain dump $DATE" >> $FILE_NAME
  22. fi
  23.  
  24. vim $FILE_NAME
  25. git add $FILE_NAME
  26. git commit -m "Brain dump $FILE_NAME"
  27. git push
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement