blob: 0c212ddf0892a57e835cf9b488860e0b71d9d374 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh -e
if [ -z "$1" ]; then
thought=$(cat | xargs)
elif [ -f "$1" ]; then
thought=$(cat "$1" | xargs)
else
thought="$*"
fi
date=$(date '+%a, %d %b %Y %T')
html_fmt='\t\t\t\t<h3>'"${date}"'<\/h3>\
\t\t\t\t<p>\
\t\t\t\t\t'"${thought}"'\
\t\t\t\t<\/p>\
'
case $(hostname -s) in
mother|po-rbo) sed="sed -i" ;;
fbsd-tp) sed="sed -i ''" ;;
esac
$sed -e '/<!-- thoughts here -->$/{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
|