view le/rn_append @ 9861:0356fbd182e8

<oerjan> ` ( head -4 bin/slashlearn | sed \'s/key/topic/;s/value/stuff/\'; tail -5 le/rn_append ) > le/rn_app; mv le/rn_app{,end}
author HackBot
date Mon, 05 Dec 2016 02:13:24 +0000
parents 07e92c85b28c
children 6cd17a5c5808
line wrap: on
line source

sep="//"
[[ "$1" == ?*"$sep"* ]] || exit 1
topic="$(echo "${1%%$sep*}" | lowercase)"
stuff="${1#*$sep}"
stuff=$(echo "$1" | cut -d / -f 2-)
perl -i -p -e 's/\n/ /' "wisdom/$topic"
echo "$stuff" >>"wisdom/$topic"
echo -n "Learned '$topic': "
cat "wisdom/$topic"