summaryrefslogtreecommitdiffstats
path: root/flags.sh
diff options
context:
space:
mode:
Diffstat (limited to 'flags.sh')
-rwxr-xr-xflags.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/flags.sh b/flags.sh
index 15a3a77..5711a18 100755
--- a/flags.sh
+++ b/flags.sh
@@ -1,11 +1,14 @@
#!/usr/bin/env bash
-set -e
+set -eu
-echo "$@" >.newflags
+OUT="$1"
+shift
-if [ -e .flags ] && cmp -s .flags .newflags; then
- rm .newflags
+echo "$@" >"$OUT.tmp"
+
+if [ -e "$OUT" ] && cmp -s "$OUT" "$OUT.tmp"; then
+ rm "$OUT.tmp"
else
- mv .newflags .flags
+ mv "$OUT.tmp" "$OUT"
fi