#!/bin/sh -e if [ -z "$1" ]; then thought=$(cat -) elif [ -f "$1" ]; then thought=$(cat "$1") else thought="$*" fi thought_a="$(printf "%s" "${thought}" | sed "s/\n/
/")" exit date=$(date '+%a, %d %b %Y %T') html_fmt='\t\t\t\t

'"${date}"'<\/h3>\ \t\t\t\t

\ \t\t\t\t\t'"${thought_a}"'\ \t\t\t\t<\/p>\ ' echo "%s" "${html_fmt}" exit case $(hostname -s) in mother|po-rbo) sed="sed -i" ;; fbsd-tp) sed="sed -i ''" ;; esac $sed -e '/$/{n;s/^/'"${html_fmt}"'/;}' \ "$HOME"/dev/web/joe-www/thoughts.html git -C "$HOME"/dev/web/joe-www add -u git -C "$HOME"/dev/web/joe-www commit -m "Thought: ${date}" git -C "$HOME"/dev/web/joe-www push vps