view bin/learn_append @ 10412:5af59ff5ca72

<hppavilion[1]> learn zed is the 26th letter of the alphabet in Commonwealth English. Why they consider what is clearly a 3-letter string to be a single letter is unclear.
author HackBot
date Wed, 15 Mar 2017 00:47:06 +0000
parents c989a1669243
children 364f0d88ee3a
line wrap: on
line source

#!/bin/bash
topic="$(echo "$1" | lowercase | sed 's/^\(an\?\|the\) //;s/s\? .*//')"
stuff=$(echo "$1" | cut -d' ' -f2-)
perl -i -p -e 's/\n/ /' "wisdom/$topic"
echo "$stuff" >>"wisdom/$topic"
echo -n "Learned '$topic': "
cat "wisdom/$topic"