diff bin/slashlearn_append @ 12187:652d1c5a24be draft

<fizzie> ` mv /hackenv/le/rn_append /hackenv/bin/slashlearn_append && ln -sf /hackenv/bin/slashlearn_append /hackenv/le/rn_append # let\'s make that consistent
author HackEso <hackeso@esolangs.org>
date Sun, 24 Nov 2019 16:31:16 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/slashlearn_append	Sun Nov 24 16:31:16 2019 +0000
@@ -0,0 +1,8 @@
+sep="//"
+[[ "$1" == ?*"$sep"* ]] || exit 1
+topic="$(echo "${1%%$sep*}" | lowercase)"
+stuff="${1#*$sep}"
+perl -i -p -e 's/\n/ /' "${HACKENV-/hackenv}/wisdom/$topic"
+echo "$stuff" >>"${HACKENV-/hackenv}/wisdom/$topic"
+echo -n "Learned '$topic': "
+cat "${HACKENV-/hackenv}/wisdom/$topic"