The source code for my blog at wxcafe.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
489 B

  1. #!/bin/bash
  2. if [[ -z "$@" ]]; then
  3. echo "add.sh <title>"
  4. exit 1
  5. fi
  6. title="$@"
  7. clean_title=$(echo $title | tr ' ' '_' | tr '[:upper:]' '[:lower:]')
  8. filename="content/$clean_title"
  9. if [[ -e $filename.md ]]; then
  10. echo "$filename.md already exists"
  11. exit 1
  12. fi
  13. echo "Title: $title" >> $filename.md
  14. echo "Date: $(date -Iminutes)" >> $filename.md
  15. echo "Author: Wxcafé" >> $filename.md
  16. echo "Slug: $clean_title" >> $filename.md
  17. echo -e '\n'>> $filename.md
  18. vim +7 $filename.md -s <( echo -n A)