annotate bin/delquote @ 12274:3c04e9ef7a3a draft

<kspalaiologos> `` cp -rf /hackenv/tmp/asmbf-1.2.7/bin/* /hackenv/lib/kps/
author HackEso <hackeso@esolangs.org>
date Tue, 31 Dec 2019 17:47:30 +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"