diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-17 18:49:42 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-17 18:49:42 -0400 |
commit | c9cfc9bc4451a6219f71407b9a6e00b51defc713 (patch) | |
tree | eee260ac1b6ff37b5fba45b89204864d810dfe67 /write-ifchanged | |
parent | 733636464ea990d96d38edefff9ca326e8195cf4 (diff) |
Use automake.mk
Diffstat (limited to 'write-ifchanged')
-rwxr-xr-x | write-ifchanged | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/write-ifchanged b/write-ifchanged new file mode 100755 index 0000000..c65fa16 --- /dev/null +++ b/write-ifchanged @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +outfile=$1 +tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" + +cat > "$tmpfile" || exit $? +if cmp -s "$tmpfile" "$outfile"; then + rm -f "$tmpfile" || : +else + mv -f "$tmpfile" "$outfile" +fi |