view le/rn_append @ 12185:42f2882255c3 draft

<fizzie> sled /hackenv/le/rn_append//s|wisdom|${HACKENV-/hackenv}/wisdom|
author HackEso <hackeso@esolangs.org>
date Sun, 24 Nov 2019 16:24:56 +0000
parents 6cd17a5c5808
children 652d1c5a24be
line wrap: on
line source

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"