Created
August 23, 2015 20:05
-
-
Save digizeph/b0b3fe5388e398e09924 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #### | |
| ## read in fields | |
| #### | |
| echo "Title:" | |
| read -e title | |
| echo "" | |
| echo "Filename:" | |
| read -e fname | |
| echo "" | |
| if [ -z "$fname" ] | |
| then | |
| fname=$title | |
| fi | |
| # change to lower case and replace spaces with '-' | |
| fname=`echo $fname| tr "[:upper:]" "[:lower:]" | tr " " "-"` | |
| echo "Categories:" | |
| read -e categories | |
| echo "" | |
| echo "Tags:" | |
| read -e tags | |
| echo "" | |
| NAME="`date +%F`-$fname.md" | |
| if [ -e $NAME ] | |
| then | |
| echo "File $NAME exists already, exit now." | |
| echo "" | |
| exit 1 | |
| fi | |
| cat > $NAME << ENDOFFILE | |
| --- | |
| layout: post | |
| title: "$title" | |
| categories: [$categories] | |
| tags: [$tags] | |
| comments: True | |
| --- | |
| ENDOFFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment