Mercurial > repo
annotate bin/delquote @ 12214:4d504750c68e draft
<oerjan> slwd locale//s,on.*le,one true locale,
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sat, 30 Nov 2019 02:12:16 +0000 |
parents | bd76992a2fec |
children |
rev | line source |
---|---|
5643 | 1 #!/bin/sh |
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 | 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 | 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" |