#!/bin/bash # WordPress posting script # config: EDITOR=vim TRANSFORM=() # empty or a subset of: 'title' 'markdown' USER="" # WP user to create the post PASSWORD="" # application password generated for your WP user SERVER="" # server hostname, optionally with subdirectories STATUS="draft" # one of publish,future,draft,pending,private CATEGORIES="" # comma separated integer IDs of categories TAGS="" # comma separated integer IDs of tags TMPFILE=/tmp/wordpress-post.txt # location of a temporary file with the post text source ~/.config/wordpress-rest-curl/config.sh # let the user create the post $EDITOR $TMPFILE || exit 1 [[ -e $TMPFILE ]] || exit 1 # transformations cp $TMPFILE $TMPFILE.trans for T in "${TRANSFORM[@]}"; do if [[ "$T" == "title" ]]; then python >$TMPFILE.trans2 <$TMPFILE.trans2 <