view bin/slashlearn @ 10220:3d2df2077c46

<shachaf> sled bin/hlnp//s#share#/hackenv/&#
author HackBot
date Wed, 08 Feb 2017 23:35:02 +0000
parents 68aaf05e3aec
children 7d14a8891360
line wrap: on
line source

sep="//"
[[ "$1" == ?*"$sep"* ]] || { echo 'All le//rn variants now use two slashes in the format.' >&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&.')"