changeset 6783:0c13247bfca4

<oerjan> ` mkdir misle; cp le/* misle; sed -i \'s/wisdom/tmflry/g\' misle/*
author HackBot
date Wed, 10 Feb 2016 06:06:12 +0000
parents 5527970a7be7
children 7fd6505bef75
files misle/rn misle/rn_append
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misle/rn	Wed Feb 10 06:06:12 2016 +0000
@@ -0,0 +1,1 @@
+sep="/"; [[ "$0" == *//* ]] && sep="//"; [[ "$1" == ?*"$sep"* ]] || exit 1; key="$(echo "${1%%$sep*}" | lowercase)"; value="${1#*$sep}"; echo "$value" > "$(echo-p "tmflry/$key")" && echo "Learned «$key»"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misle/rn_append	Wed Feb 10 06:06:12 2016 +0000
@@ -0,0 +1,9 @@
+#!/bin/bash
+[[ "$1" = */* ]] || exit
+topic=$(echo "$1" | lowercase | cut -d / -f 1)
+[ -z "$topic" ] && exit 1
+stuff=$(echo "$1" | cut -d / -f 2-)
+perl -i -p -e 's/\n/ /' "tmflry/$topic"
+echo "$stuff" >>"tmflry/$topic"
+echo -n "Learned '$topic': "
+cat "tmflry/$topic"