Skip to content

Instantly share code, notes, and snippets.

@llbbl
Created November 26, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llbbl/1054a5656889da3a823c to your computer and use it in GitHub Desktop.
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.
#!/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