summaryrefslogtreecommitdiff
path: root/tools/maybe-mv
blob: 996052f42317f2f17c7d6cf109c9082f2430d962 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#!/bin/bash -eu
# Replace one file with another, but maybe don't update the timestamp
if cmp "$1" "$2"
then
    echo rm "$1"
    rm "$1"
else
    echo mv "$1" "$2"
    mv "$1" "$2"
fi