view bin/slashlearn @ 11989:fdd44c90d7d2 draft

<kspalaiologos> le//rn asmbf//Wrapper around bfasm, that automatically converts slashes to newlines and feeds it into original compiler
author HackEso <hackeso@esolangs.org>
date Thu, 24 Oct 2019 19:43:23 +0000
parents 7d14a8891360
children 8c13cadf308f
line wrap: on
line source

sep="//"
[[ "$1" == ?*"$sep"* ]] || { echo 'Usage: `le/[/]rn <key>//<wisdom>' >&2 ; exit 1; }
key="$(echo "${1%%$sep*}" | lowercase)"
value="${1#*$sep}"
[ -e "wisdom/$key" ] && verb="Relearned" || verb="Learned"
echo "$value" > "$(echo-p "wisdom/$key")" && echo -n "$verb '$key': $(echo "$value" | sed 's.^[ ].0,04&.')"