annotate bin/learn_append @ 11579:977eb86d5521 draft

<oerjan> learn NVG is a student computer club in Trondheim, whose servers are frequently infiltrated by oerjan. Not to be confused with nvd.
author HackEso <hackeso@esolangs.org>
date Mon, 18 Jun 2018 00:58:34 +0100
parents 364f0d88ee3a
children 60f7b5cdcdb7
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
11265
364f0d88ee3a <oerjan> sled bin/learn_append//2s,s/.*;,,
HackBot
parents: 9075
diff changeset
2 topic="$(echo "$1" | lowercase | sed 's/s\? .*//')"
9075
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"