Mercurial > repo
annotate bin/delquote @ 12234:2adccbc5ece3 draft
<b_jonas> addwhatis whatis(1hackeso) - display one-line manual page descriptions
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Thu, 05 Dec 2019 21:02:31 +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" |