view bin/slashlearn @ 9880:68aaf05e3aec

<oerjan> sled bin/slashlearn//2s,exit 1,&;,
author HackBot
date Tue, 06 Dec 2016 03:11:15 +0000
parents f931749ff54e
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&.')"