= Gopher Logging in Eleven Lines of Shell =
Writing today's entry is a bit tricky because I'm writing it with
the help of the very thing I'm writing about; describing the
thing with the thing. It feels a little like "Drawing Hands",
the MC Escher lithograph where a pair of hands draws each other
nto existance.
As the title suggests, I finally broke down and scripted these
the computer do the work", but I often get myself into trouble
by putting the cart before the horse: inventing automation for
things I haven't done yet even once manually. Not this time;
A whole three! I'm practically an old hand, now.
Further, I practiced great restraint in the automation.
So here are the eleven lines:
today.sh
------------------------------------------------------------------
#!/bin/sh
title=$1
date=$(date +%Y-%m-%d)
fname="$date-$(echo "$title" | tr ' ' '-')"
srcpath="src/phlog/$fname"
if [ ! -f $srcpath ]; then echo "= $title =" >> $srcpath; fi
vim $srcpath
sed "s//$date/" src/gophermap > publish/goph...
fmt -w67 $srcpath > publish/phlog/$fname
scp publish/gophermap $sdf:gopher/
scp publish/phlog/$fname $sdf:gopher/phlog/
------------------------------------------------------------------
To create this entry, I typed (let's see...CTRL-Z...)
$ ./today.sh "Gopher Logging in Eleven Lines of Shell"
Which created the file you're now reading and wrote the title at
the top. As soon as I finish editing this, it will pass the file
through 'fmt' to reflow the paragraphs to a mainframe-worthy 67
columns, and then upload the result to my Gopher space on SDF.org.
The neat bit, as you may have noticed above, is that I have also
turned my gophermap file into an ad-hoc template by putting a
Last updated:
Which is replaced by the 'sed' command with the current date.
The new gophermap is also written and uploaded.
Here's what the structure looks like:
dave@wizard~/d/proj/sdf/gopher$ tree
.
├── publish
│ ├── gophermap
│ └── phlog
│ ├── 2018-08-09-First-Post
│ ├── 2018-08-10-The-Logging-Habit
│ └── 2018-08-12-Weekend-Tech-Scramble
├── src
│ ├── gophermap
│ └── phlog
│ ├── 2018-08-09-First-Post
│ ├── 2018-08-10-The-Logging-Habit
│ ├── 2018-08-12-Weekend-Tech-Scramble
│ └── 2018-08-13-Gopher-Logging-in-Elev...
└── today.sh
4 directories, 10 files
As soon as I save this, the new entry will end up in the publish/
long. But for now, I'm reveling in the minimalism. I'll try
to hold off on complexity for as long as I can.
Oh, and I must add that I would absolutely be using 'rsync', but
t turns out that you have to be a MetaARPA member on SDF to have
-r' to recursively copy everything in publish/, but that would
* * *
the #gopher channel.
This is a very warm little community so far and I feel very much
at home here in my little burrow.
Good night my fellow rodents!
* * *
Next morning update: Naturally there was a mistake in one of the
"eleven lines" and my script happily published the *unformatted*
version of the entry. My appologies to anyone who tried to
bad descisions...which is why I have a strict policy about not
(and the copy of it above). We'll see if I got it right when