# HG changeset patch # User HackEso # Date 1573945704 0 # Node ID bd76992a2feca9d654f03577a6d5277bc9f5f1cf # Parent e1ce00d00682814f76ae37bb1079f0c45362411a fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote diff -r e1ce00d00682 -r bd76992a2fec bin/delquote --- a/bin/delquote Sat Nov 16 23:05:39 2019 +0000 +++ b/bin/delquote Sat Nov 16 23:08:24 2019 +0000 @@ -1,9 +1,9 @@ #!/bin/sh id=$1 +db="${HACKENV-/hackenv}/quotes" 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 +head -n $((id-1)) "$db" >"$db".new +tail -n +$((id+1)) "$db" >>"$db".new +diff "$db" "$db".new >/dev/null && exit 1 printf "*poof*%s" "$(quote $id | cut -d')' -f2-)" -mv quotes.new quotes - +mv "$db".new "$db"