view bin/learn_append @ 5044:301d8fcdf2b3

<oerjan> sed -i \'6cecho -n "Learned \'"\'"\'$topic\'"\'"\': "\\\'"\\n"\'cat "wisdom/$topic"\' bin/learn_append
author HackBot
date Fri, 10 Oct 2014 11:39:30 +0000
parents 8d2b2b7ca563
children 84864da646b0
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': "\ncat "wisdom/$topic"