commit 422a94a366932bc9fd7bd019ba83d6aa3b45a69b
parent 44103101a2b6a4ec1f46680b38d5a3705f3bc142
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sat, 27 Jun 2020 14:22:28 +0200
Fix logic in main loop
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/.local/bin/memeadd b/.local/bin/memeadd
@@ -21,11 +21,10 @@ fi
for f in "$files"; do
n="$(basename "$f")"
tag="#${n%.*}"
- if ! grep -q "$tag" "$out"; then
- printf '%s %s\n' "$tag" "$url" >> "$out"
- else
+ if grep -q "$tag" "$out"; then
printf '%s: error: tag %s already exists\n' "${0##*/}" "$tag" >&2
exit 1
fi
url="$(upload -o -p "$f")"
+ printf '%s %s\n' "$tag" "$url" >> "$out"
done