view bin/delquote @ 12523:67a2e5342dad draft default tip

<b_jonas> learn The password of the month is outside the scope of this wisdom entry.
author HackEso <hackeso@esolangs.org>
date Tue, 01 Apr 2025 08:17:53 +0100
parents bd76992a2fec
children
line wrap: on
line source

#!/bin/sh
id=$1
db="${HACKENV-/hackenv}/quotes"
expr "$1" + 0 >/dev/null 2>&1 || exit 1
head -n $((id-1)) "$db" >"$db".new
tail -n +$((id+1)) "$db" >>"$db".new
diff "$db" "$db".new >/dev/null && exit 1
printf "*poof*%s" "$(quote $id | cut -d')' -f2-)"
mv "$db".new "$db"