annotate bin/learn_append @ 6568:79f2f9044f0b

<tswett> learn IYAM is like IANAL, except yam instead of anal.
author HackBot
date Sat, 16 Jan 2016 22:17:10 +0000
parents 38b26e48d344
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5643
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
1 #!/bin/bash
6445
38b26e48d344 <olsner> ` sed -i \'/^topic/ s/\\$.*$/"&"/\' bin/learn_append
HackBot
parents: 5643
diff changeset
2 topic="$(echo "$1" | lowercase | sed 's/^\(an\?\|the\) //;s/s\? .*//')"
5643
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
3 stuff=$(echo "$1" | cut -d' ' -f2-)
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
4 perl -i -p -e 's/\n/ /' "wisdom/$topic"
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
5 echo "$stuff" >>"wisdom/$topic"
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
6 echo -n "Learned '$topic': "
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
7 cat "wisdom/$topic"