view bin/slashlearn @ 11951:f96359542199 draft

<ais523> ` printf \'#include <stdio.h>\\nint main(void) { float C = 4.0; printf("%%f", C/C++); }\' | gcc -fno-diagnostics-color -Wall -Wextra -x c /dev/stdin
author HackEso <hackeso@esolangs.org>
date Thu, 19 Sep 2019 17:56:36 +0000
parents 7d14a8891360
children 8c13cadf308f
line wrap: on
line source

sep="//"
[[ "$1" == ?*"$sep"* ]] || { echo 'Usage: `le/[/]rn <key>//<wisdom>' >&2 ; 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&.')"