Search code examples
bashshellscp

Shellscript action if two files are different


I am importing a file to my server using this command:

scp zumodo@shold:/test/test/test/server.py /test/test/test/test.py~/;

I want to restart my server if the newly imported file test.py~ differs from the test.py that already exists. How would I do this using a shellscript?


Solution

  • You could diff() the two files. A return code of zero (0) means there are no differences. A return code of one (1) says the files differ.