Created
December 16, 2015 05:56
-
-
Save calweb/01f2de9b04c55ae91cfa to your computer and use it in GitHub Desktop.
small bash script that creates a file based on the args, slugified (eg. sh new-post.sh my shiny new blog post)
This file contains 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 | |
DAY_DIR=$(date +%d) | |
MONTH_DIR=$(date +%m) | |
YEAR_DIR=$(date +%Y) | |
SLUGIFIED="$(echo "$@" | sed -e 's/[^[:alnum:]]/-/g' \ | |
| tr -s '-' | tr A-Z a-z)" | |
mkdir -p "_site/${YEAR_DIR}/${MONTH_DIR}/${DAY_DIR}" | |
touch "_site/${YEAR_DIR}/${MONTH_DIR}/${DAY_DIR}/${SLUGIFIED}.md" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment