view misle/rn_append @ 6783:0c13247bfca4

<oerjan> ` mkdir misle; cp le/* misle; sed -i \'s/wisdom/tmflry/g\' misle/*
author HackBot
date Wed, 10 Feb 2016 06:06:12 +0000
parents
children c6bb618e60e3
line wrap: on
line source

#!/bin/bash
[[ "$1" = */* ]] || exit
topic=$(echo "$1" | lowercase | cut -d / -f 1)
[ -z "$topic" ] && exit 1
stuff=$(echo "$1" | cut -d / -f 2-)
perl -i -p -e 's/\n/ /' "tmflry/$topic"
echo "$stuff" >>"tmflry/$topic"
echo -n "Learned '$topic': "
cat "tmflry/$topic"