changeset 1873:2fec55699b70

<Jafet> sed -ie \'3 s,.*,if ! expr "$id" ">=" 0 "\\&" "$id" "<" $(wc -l <quotes) >/dev/null; then id=$(expr $RANDOM % $(wc -l <quotes); fi,\' bin/delquote
author HackBot
date Sun, 27 Jan 2013 04:45:15 +0000
parents 8e36fd863e84
children 2355c0160b25
files bin/delquote bin/delquotee
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bin/delquote	Sun Jan 27 04:42:04 2013 +0000
+++ b/bin/delquote	Sun Jan 27 04:45:15 2013 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 id=$1
-expr "$1" + 0 >/dev/null 2>&1 || exit 1
+if ! expr "$id" ">=" 0 "&" "$id" "<" $(wc -l <quotes) >/dev/null; then id=$(expr $RANDOM % $(wc -l <quotes); fi
 head -n $((id-1)) quotes >quotes.new
 tail -n +$((id+1)) quotes >>quotes.new
 diff quotes quotes.new >/dev/null && exit 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/delquotee	Sun Jan 27 04:45:15 2013 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+id=$1
+expr "$1" + 0 >/dev/null 2>&1 || exit 1
+head -n $((id-1)) quotes >quotes.new
+tail -n +$((id+1)) quotes >>quotes.new
+diff quotes quotes.new >/dev/null && exit 1
+printf "*poof*%s" "$(quote $id | cut -d')' -f2-)"
+mv quotes.new quotes
+