annotate bin/delquote @ 12320:9c7eb9899d95 draft

<fizzie> le/rn karma//All living beings have actions (karma) as their own, their inheritance, their congenital cause, their kinsman, their refuge. It is karma that differentiates beings into low and high states.
author HackEso <hackeso@esolangs.org>
date Fri, 06 Mar 2020 23:08:37 +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"