Skip to content

Instantly share code, notes, and snippets.

@gpsarkar
Created August 16, 2018 20:28
Show Gist options
  • Save gpsarkar/a3eca4dd9ea4d352fffb9836a170292c to your computer and use it in GitHub Desktop.
Save gpsarkar/a3eca4dd9ea4d352fffb9836a170292c to your computer and use it in GitHub Desktop.
linux diff script
#!/bin/bash
timestamp=`date "+%Y%m%d"`
source='/storage/source/'
target='/storage/target/'
exclude='folder'
diff --strip-trailing-cr --suppress-common-lines --ignore-case \
--ignore-tab-expansion --ignore-trailing-space --ignore-space-change \
--ignore-all-space --ignore-blank-lines \
--recursive --side-by-side \
\
-r ${source} ${target} \
-x ${exclude}
\
2>&1 | tee ~/diff_${timestamp}_detailed
diff --strip-trailing-cr --suppress-common-lines --ignore-case \
--ignore-tab-expansion --ignore-trailing-space --ignore-space-change \
--ignore-all-space --ignore-blank-lines \
--brief --recursive \
\
-r ${source} ${target} \
-x ${exclude}
\
> ~/diff_${timestamp}_brief
echo -e "\n\n==============================================================================="
echo -e "____Diff output saved to:"
echo -e "\t\t ~/diff_${timestamp}_detailed"
echo -e "\t\t ~/diff_${timestamp}_brief"
echo -e "\n================================================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment