view le/rn_append @ 8739:246ef324b55e

<pikhq> ` cat >src/pikhqbow.c <<<$\'#include <stdio.h>\\n#include <wchar.h>\\n\'\'int main(){wint_t c;int a=2;b:c=fgetwc(stdin);if(c==EOF) return 0;printf("\\x03%02d%s%lc",a,c==L\',\'?",99":"",c);a++;if(a==14)a=2;goto b;}\'
author HackBot
date Tue, 05 Jul 2016 04:37:49 +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"