#!/bin/sh read -rp 'Title: ' title draft=drafts/$(date +'%Y-%m-%d')-$(printf "$title" | tr -Cs '[:alnum:]' '-' | tr '[:upper:]' '[:lower:]').php cat > "$draft" << EOF EOF $EDITOR "$draft" read -rp 'Publish? [y/N]: ' choice [ 'y' = "$choice" ] && mv "$draft" posts/ || echo Saved draft. read -rp 'Go live? [y/N]: ' choice [ 'y' = "$choice" ] && git commit && git push origin && git push live || echo Deferred publish.