view bin/slashlearn @ 5867:9c603f748542

<int-e> ` sed -i 1a\'[[ "$1" = */* ]] || exit\' bin/slashlearn
author HackBot
date Wed, 22 Jul 2015 21:53:01 +0000
parents e281f5947a6a
children 73ffca368bac
line wrap: on
line source

#!/bin/bash
[[ "$1" = */* ]] || exit
topic=$(echo "$1" | lowercase | cut -d / -f 1)
[ -z "$topic" ] && exit 1
value=$(echo "$1" | cut -d / -f 2-)
echo "$value" > wisdom/"$topic" && echo "Learned «$topic»"