annotate bin/learn_append @ 10310:fc068f57c09a

<oerjan> learn `edit <file> gives you a url, then in your browser: (1) Press Fetch (2) Make your changes (3) Press edit (4) Paste the command line at the top into the channel.
author HackBot
date Fri, 17 Feb 2017 18:53:50 +0000
parents c989a1669243
children 364f0d88ee3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9075
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
1 #!/bin/bash
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
2 topic="$(echo "$1" | lowercase | sed 's/^\(an\?\|the\) //;s/s\? .*//')"
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
3 stuff=$(echo "$1" | cut -d' ' -f2-)
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
4 perl -i -p -e 's/\n/ /' "wisdom/$topic"
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
5 echo "$stuff" >>"wisdom/$topic"
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
6 echo -n "Learned '$topic': "
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
7 cat "wisdom/$topic"