view le/rn_append @ 8105:a4b12fe8addb

<b_jonas> `` >> wisdom/\xe1\x9b\x81\xe1\x9a\xbf echo \'\xe1\x9b\x85\xe1\x9b\x8b. \xe1\x9a\xb4\xe1\x9a\xae\xe1\x9a\xa6 \xe1\x9a\xa0\xe1\x9b\x85\xe1\x9a\xb4\xe1\x9b\x81. \xe1\x9b\x86\xe1\x9b\xa6\xe1\x9a\xbf\xe1\x9b\x85 \xe1\x9b\x8b\xe1\x9b\x86\xe1\x9a\xb4\xe1\x9a\xbf\xe1\x9a\xa2\xe1\x9b\x8b\xe1\x9b\x8b\xe1\x9b\x85\xe1\x9b\xaf\'
author HackBot
date Mon, 23 May 2016 21:35:12 +0000
parents 07e92c85b28c
children 0356fbd182e8
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/ /' "wisdom/$topic"
echo "$stuff" >>"wisdom/$topic"
echo -n "Learned '$topic': "
cat "wisdom/$topic"