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"; }

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.

if [ -n "$2" ]; then
vi tmpfile; BODY=`cat tmpfile`; rm tmpfile
if [ -n "$1" ]; then
echo -n "Subject:"; read SUBJECT
echo "$BODY" | mail -s "$SUBJECT"

Similar Posts:

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *