view bin/slashlearn @ 10060:530b444efb33

<shachaf> mkx bin/dedot//print_args_or_input "$2\' | sed \'s.\xcc\x88..\'
author HackBot
date Sat, 31 Dec 2016 19:16:01 +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&.')"