summaryrefslogtreecommitdiffstats
path: root/flags.sh
blob: 5711a1890c4154af01fdf4bb08327ecb2eab98dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bash

set -eu

OUT="$1"
shift

echo "$@" >"$OUT.tmp"

if [ -e "$OUT" ] && cmp -s "$OUT" "$OUT.tmp"; then
    rm "$OUT.tmp"
else
    mv "$OUT.tmp" "$OUT"
fi