Created
November 26, 2015 18:39
-
-
Save llbbl/1054a5656889da3a823c to your computer and use it in GitHub Desktop.
Compare two files and if they are different overwrite the second one with the first one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filePath1="$1" | |
filePath2="$2" | |
if cmp -s "$1" "$2" | |
then | |
echo "match" | |
else | |
echo "different" | |
cat $1 > $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment