annotate bin/learn_append @ 5326:251f5b3167b6

<izabera> ` echo harry ron hermione >> bin/emptylist
author HackBot
date Thu, 23 Apr 2015 06:53:55 +0000
parents 4c440ec17bf2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5003
8d2b2b7ca563 <oerjan> revert 4999
HackBot
parents:
diff changeset
1 #!/bin/bash
8d2b2b7ca563 <oerjan> revert 4999
HackBot
parents:
diff changeset
2 topic=$(echo "$1" | lowercase | sed 's/^\(an\?\|the\) //;s/s\? .*//')
8d2b2b7ca563 <oerjan> revert 4999
HackBot
parents:
diff changeset
3 stuff=$(echo "$1" | cut -d' ' -f2-)
8d2b2b7ca563 <oerjan> revert 4999
HackBot
parents:
diff changeset
4 perl -i -p -e 's/\n/ /' "wisdom/$topic"
8d2b2b7ca563 <oerjan> revert 4999
HackBot
parents:
diff changeset
5 echo "$stuff" >>"wisdom/$topic"
5047
4c440ec17bf2 <oerjan> sed -i \'6s/[*]/"\\n/\' bin/learn_append
HackBot
parents: 5046
diff changeset
6 echo -n "Learned '$topic': "
4c440ec17bf2 <oerjan> sed -i \'6s/[*]/"\\n/\' bin/learn_append
HackBot
parents: 5046
diff changeset
7 cat "wisdom/$topic"