summaryrefslogtreecommitdiff
path: root/tools/maybe-mv
diff options
context:
space:
mode:
Diffstat (limited to 'tools/maybe-mv')
-rwxr-xr-xtools/maybe-mv8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/maybe-mv b/tools/maybe-mv
new file mode 100755
index 0000000..725b86b
--- /dev/null
+++ b/tools/maybe-mv
@@ -0,0 +1,8 @@
+#!/bin/bash -eu
+# Replace one file with another, but maybe don't update the timestamp
+if cmp -s "$1" "$2"
+then
+ rm "$1"
+else
+ mv "$1" "$2"
+fi