Mercurial > repo
changeset 5152:9c7426991c5f
<shachaf> ` sed -i -e \'3a [ -e wisdom/"$topic" ] && op=\'\\\'\'Overwrote\'\\\'\' || op=\'\\\'\'Wrote\'\\\'\'\' -e \'s/Learned/$op/\' bin/slashlearn
author | HackBot |
---|---|
date | Wed, 19 Nov 2014 10:31:53 +0000 |
parents | c01d76664afd |
children | a96e44af629d |
files | bin/slashlearn |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/slashlearn Wed Nov 19 10:16:15 2014 +0000 +++ b/bin/slashlearn Wed Nov 19 10:31:53 2014 +0000 @@ -1,5 +1,6 @@ #!/bin/bash topic=$(echo "$1" | lowercase | cut -d / -f 1) [ -z "$topic" ] && exit 1 +[ -e wisdom/"$topic" ] && op='Overwrote' || op='Wrote' value=$(echo "$1" | cut -d / -f 2-) -echo "$value" > wisdom/"$topic" && echo "Learned «$topic»" +echo "$value" > wisdom/"$topic" && echo "$op «$topic»"