Things I tend to forget


CLI Blogging code

Bookmark this category
How it’s done. I started out with a bash function as described earlier. The function code is below:
function blog() { echo "$2" | mail -s "$1" address@example.com; }

Then I noticed I would need more freedom to write longer text, without leaving the shell. So here goes the “blog” bash script. I’m using the postie wordpress plugin on the server side, so things are a bit more manageable. I may add more to this later if I get time.

#!/bin/bash
if [ -n "$2" ]; then
BODY=$2
else
vi tmpfile; BODY=`cat tmpfile`; rm tmpfile
fi
if [ -n "$1" ]; then
SUBJECT=$1
else
echo -n "Subject:"; read SUBJECT
fi
echo "$BODY" | mail -s "$SUBJECT" address@example.com

Similar Posts:




Another CLI post (via postie)

Bookmark this category
Testing CLI blogging with temp files and VI integration. weeee!

Similar Posts:

    None Found




Live From The Field (via postie)

Bookmark this category
Another CLI post

Similar Posts:

    None Found




CLI blogging with Postie (via postie)

Bookmark this category
Another blogging test using the postie plugin

Similar Posts: