annotate le/rn_append @ 7759:b4341511eb47

<fizzie> ` echo -e \'#! /bin/bash\\ncmd="$1"\\nshift\\nf="$*"\\nif [ -z "$f" && "$f" == *\\\\ * ]; then f="${cmd#* }"; cmd="${cmd%% *}"; fi\\nif [ -z "$f" ]; then echo try: \\\\`f command filename; else "$cmd" "$(< "$f")"; fi\' > bin/f
author HackBot
date Wed, 04 May 2016 21:35:48 +0000
parents 07e92c85b28c
children 0356fbd182e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6452
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
1 #!/bin/bash
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
2 [[ "$1" = */* ]] || exit
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
3 topic=$(echo "$1" | lowercase | cut -d / -f 1)
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
4 [ -z "$topic" ] && exit 1
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
5 stuff=$(echo "$1" | cut -d / -f 2-)
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
6 perl -i -p -e 's/\n/ /' "wisdom/$topic"
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
7 echo "$stuff" >>"wisdom/$topic"
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
8 echo -n "Learned '$topic': "
07e92c85b28c <oerjan> ` cat le/rn bin/learn_append | sed \'6,9d;s/value/stuff/\' >le/rn_append; chmod +x le/rn_append
HackBot
parents:
diff changeset
9 cat "wisdom/$topic"