Mercurial > repo
annotate bin/slashlearn @ 9879:f931749ff54e
<oerjan> sled bin/slashlearn//2s,exit 1,{ echo \'All le//rn variants now use two slashes in the format.\' >\\&2 ; exit 1 },
author | HackBot |
---|---|
date | Tue, 06 Dec 2016 03:09:19 +0000 |
parents | 3238443d09f6 |
children | 68aaf05e3aec |
rev | line source |
---|---|
9857 | 1 sep="//" |
9879
f931749ff54e
<oerjan> sled bin/slashlearn//2s,exit 1,{ echo \'All le//rn variants now use two slashes in the format.\' >\\&2 ; exit 1 },
HackBot
parents:
9860
diff
changeset
|
2 [[ "$1" == ?*"$sep"* ]] || { echo 'All le//rn variants now use two slashes in the format.' >&2 ; exit 1 } |
9466 | 3 key="$(echo "${1%%$sep*}" | lowercase)" |
4 value="${1#*$sep}" | |
5 [ -e "wisdom/$key" ] && verb="Relearned" || verb="Learned" | |
9858 | 6 echo "$value" > "$(echo-p "wisdom/$key")" && echo -n "$verb '$key': $(echo "$value" | sed 's.^[ ].0,04&.')" |