Skip to content

Instantly share code, notes, and snippets.

@viniceosm
Created October 9, 2019 13:12
Show Gist options
  • Save viniceosm/c9cf892a78c26ab5d73b093f742d31c6 to your computer and use it in GitHub Desktop.
Save viniceosm/c9cf892a78c26ab5d73b093f742d31c6 to your computer and use it in GitHub Desktop.
watch diff files and cp
#!/bin/bash
arquivoAlterando="~/dev/app.js";
arquivoAlterar="~/test/app.js";
while true ;do
sIsDiff=$(diff -q ${arquivoAlterando} ${arquivoAlterar});
if [[ $sIsDiff != "" ]] ;then
isDiff=true;
else
isDiff=false;
fi
if $isDiff ;then
cp ${arquivoAlterando} ${arquivoAlterar};
echo "[$(date +%H:%M:%S)]" ${arquivoAlterando} "->" ${arquivoAlterar};
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment