annotate bin/delquote @ 12256:821155c00e34 draft

<fizzie> ` sed -e \'s|wisdom|bin|\' < ../bin/culprits > ../bin/cblprits; chmod a+x ../bin/cblprits
author HackEso <hackeso@esolangs.org>
date Sat, 07 Dec 2019 23:36:22 +0000
parents bd76992a2fec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5643
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
1 #!/bin/sh
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
2 id=$1
12117
bd76992a2fec <fizzie> fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote
HackEso <hackeso@esolangs.org>
parents: 5643
diff changeset
3 db="${HACKENV-/hackenv}/quotes"
5643
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
4 expr "$1" + 0 >/dev/null 2>&1 || exit 1
12117
bd76992a2fec <fizzie> fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote
HackEso <hackeso@esolangs.org>
parents: 5643
diff changeset
5 head -n $((id-1)) "$db" >"$db".new
bd76992a2fec <fizzie> fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote
HackEso <hackeso@esolangs.org>
parents: 5643
diff changeset
6 tail -n +$((id+1)) "$db" >>"$db".new
bd76992a2fec <fizzie> fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote
HackEso <hackeso@esolangs.org>
parents: 5643
diff changeset
7 diff "$db" "$db".new >/dev/null && exit 1
5643
56dcce63901b <tswett> revert
HackBot
parents:
diff changeset
8 printf "*poof*%s" "$(quote $id | cut -d')' -f2-)"
12117
bd76992a2fec <fizzie> fetch /hackenv/bin/delquote https://hack.esolangs.org/get/bin/delquote
HackEso <hackeso@esolangs.org>
parents: 5643
diff changeset
9 mv "$db".new "$db"