view bin/slashlearn @ 9572:98c473a71c18

<fizzie> ` mv airport bin/airport-lookup; mkx \'bin/airport//airport-lookup any "$*"\'; mkx \'bin/icao//airport-lookup icao "$*"\'; mkx \'bin/iata//airport-lookup iata "$*"\'
author HackBot
date Sun, 30 Oct 2016 23:43:47 +0000
parents 7f38c3d1c3a5
children eee3c706c9e7
line wrap: on
line source

sep="/"
[[ "$0" == *//* ]] && sep="//"
[[ "$1" == ?*"$sep"* ]] || 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&.')"